Hi, Thank you for your email. The error in the previous program was indeed due to the missing "SNESSetFromOptions". I use the /snes/example/tutorial/ex1.cpp as test case. However, I found that some of the statements in the program were not compiled and deleted the statements containing "MPI_Comm_size", but I don't know how to solve this problem.
lerui@yu1994-ThinkPad-W520:~/tem2/build2$ cmake .. -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for one of the modules 'PETSc' pkg include dirs: /home/lerui/petsc-3.12.2/arch-linux2-c-debug/include;/home/lerui/petsc-3.12.2/include pkg include libs: petsc pkg ldflags: -L/home/lerui/petsc-3.12.2/arch-linux2-c-debug/lib;-lpetsc -- Configuring done -- Generating done -- Build files have been written to: /home/lerui/tem2/build2 lerui@yu1994-ThinkPad-W520:~/tem2/build2$ make Scanning dependencies of target main [ 50%] Building CXX object CMakeFiles/main.dir/ex1.cpp.o [100%] Linking CXX executable main /usr/bin/ld: CMakeFiles/main.dir/ex1.cpp.o: undefined reference to symbol 'MPI_Comm_size' /home/lerui/petsc-3.12.2/arch-linux2-c-debug/lib/libmpi.so.12: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status CMakeFiles/main.dir/build.make:94: recipe for target 'main' failed make[2]: *** [main] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/main.dir/all' failed make[1]: *** [CMakeFiles/main.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 Thanks, Yingjie Jed Brown <[email protected]> 于2019年12月6日周五 上午10:54写道: > Yingjie Wu <[email protected]> writes: > > > I'm so sorry that I've ignored your previous advices. > > > > I added a global variable that seems works: > > > > > > export > > > LD_LIBRARY_PATH=/home/lerui/petcs-3.12.2/arch-linux2-c-debug/lib:$LD_LIBRARY_PATH > > > > > > How should I make petsc in a standard position?This eliminates the need > to > > set global variables. > > You can configure PETSc with --prefix=/your/standard/path, then make > install. > > > It seems that some of the options before running fit become unavailable: > > > > > > mpiexec -n 1 ./example01cmke -snes_view > > > > > > Options-snes _ view are not used and how should I solve this problem? > > I don't have your ex1.cpp, but presumably you didn't SNESSetFromOptions? >
