<div dir="ltr">It sounds like your C++ compiler is name mangling the symbol, but the library has no mangling.<div>Why are you using C++.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 6, 2019 at 10:44 AM Yingjie Wu <<a href="mailto:yjwu16@gmail.com">yjwu16@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div>Thank you for your email.</div><div><p style="margin:0px;white-space:pre-wrap">The error in the previous program was indeed due to the missing "SNESSetFromOptions".</p></div><div>I use the /snes/example/tutorial/ex1.cpp as test case. However, <span style="white-space:pre-wrap">I found that some of the statements in the program were not compiled and deleted the statements containing "</span>MPI_Comm_size<span style="white-space:pre-wrap">", but I don't know how to solve this problem.</span></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>lerui@yu1994-ThinkPad-W520:~/tem2/build2$ cmake ..<br>-- The C compiler identification is GNU 5.4.0<br>-- The CXX compiler identification is GNU 5.4.0<br>-- Check for working C compiler: /usr/bin/cc<br>-- Check for working C compiler: /usr/bin/cc -- works<br>-- Detecting C compiler ABI info<br>-- Detecting C compiler ABI info - done<br>-- Detecting C compile features<br>-- Detecting C compile features - done<br>-- Check for working CXX compiler: /usr/bin/c++<br>-- Check for working CXX compiler: /usr/bin/c++ -- works<br>-- Detecting CXX compiler ABI info<br>-- Detecting CXX compiler ABI info - done<br>-- Detecting CXX compile features<br>-- Detecting CXX compile features - done<br>-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") <br>-- Checking for one of the modules 'PETSc'<br>pkg include dirs: /home/lerui/petsc-3.12.2/arch-linux2-c-debug/include;/home/lerui/petsc-3.12.2/include<br>pkg include libs: petsc<br>pkg ldflags: -L/home/lerui/petsc-3.12.2/arch-linux2-c-debug/lib;-lpetsc<br>-- Configuring done<br>-- Generating done<br>-- Build files have been written to: /home/lerui/tem2/build2<br>lerui@yu1994-ThinkPad-W520:~/tem2/build2$ make<br>Scanning dependencies of target main<br>[ 50%] Building CXX object CMakeFiles/main.dir/ex1.cpp.o<br>[100%] Linking CXX executable main<br>/usr/bin/ld: CMakeFiles/main.dir/ex1.cpp.o: undefined reference to symbol 'MPI_Comm_size'<br>/home/lerui/petsc-3.12.2/arch-linux2-c-debug/lib/libmpi.so.12: error adding symbols: DSO missing from command line<br>collect2: error: ld returned 1 exit status<br>CMakeFiles/main.dir/build.make:94: recipe for target 'main' failed<br>make[2]: *** [main] Error 1<br>CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/main.dir/all' failed<br>make[1]: *** [CMakeFiles/main.dir/all] Error 2<br>Makefile:83: recipe for target 'all' failed<br>make: *** [all] Error 2<span style="white-space:pre-wrap"><br></span></div></blockquote>Thanks,<div>Yingjie</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> 于2019年12月6日周五 上午10:54写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Yingjie Wu <<a href="mailto:yjwu16@gmail.com" target="_blank">yjwu16@gmail.com</a>> writes:<br>
<br>
> I'm so sorry that I've ignored your previous advices.<br>
><br>
> I added a global variable that seems works:<br>
><br>
><br>
> export<br>
> LD_LIBRARY_PATH=/home/lerui/petcs-3.12.2/arch-linux2-c-debug/lib:$LD_LIBRARY_PATH<br>
><br>
><br>
> How should I make petsc in a standard position?This eliminates the need to<br>
> set global variables.<br>
<br>
You can configure PETSc with --prefix=/your/standard/path, then make install.<br>
<br>
> It seems that some of the options before running fit become unavailable:<br>
><br>
><br>
> mpiexec -n 1 ./example01cmke -snes_view<br>
><br>
><br>
> Options-snes _ view are not used and how should I solve this problem?<br>
<br>
I don't have your ex1.cpp, but presumably you didn't SNESSetFromOptions?<br>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div>