Re: [petsc-users] CMake error in PETSc

2019-12-09 Thread Yingjie Wu
Thank you for your response, Barry
It works for me! I made some minor changes.

I found that there was no petsc.pc in my pkgconfig folder, but PETSc.pc.

So I rewrote it to:

execute_process ( COMMAND pkg-config PETSc .

And the program can run and will not report an DSO error.


Thanks again for your help.

Yingjie
Smith, Barry F.  于2019年12月9日周一 下午9:56写道:

>
>The problem is that your Cmake file knows nothing about the MPI
> compilers that are required and hence just selects some random compilers it
> found in the path which do not support MPI.
>
>I have attached a new CMakeList.txt for you to try.
>
>I uses the environmental variables PETSC_DIR and PETSC_ARCH to find the
> configuration file AND use the compilers from the configuration file. It
> works for me, please let me know if you have trouble.
>
>Barry
>
>
>
> > On Dec 8, 2019, at 10:38 PM, Yingjie Wu  wrote:
> >
> > Thank you very much for your help.
> > My programs are as follow
> > Smith, Barry F.  于2019年12月9日周一 下午12:29写道:
> >
> >There is something missing in the cmake process that is causing
> needed libraries not to be linked.
> >
> >Please email your program and your CMake stuff (files you use) so we
> can reproduce the problem and find a fix.
> >
> >Barry
> >
> >
> > > On Dec 8, 2019, at 10:06 PM, Yingjie Wu  wrote:
> > >
> > > Hi,
> > > Thank you for your response.
> > > This problem has not been solved. I've been reporting errors in the
> process of 'make'. The test example I used comes from: /snes /example
> /tutorials/ex3.c by modifying the suffix of ex3, there will be different
> error messages as following. I checked a lot of DSO problems on the
> Internet and installed a lot of libraries, but the error still haven't been
> solved. I was wondering if I was missing any prefix during the configure of
> PETSc(I use the simplest recommended installation), but there was no
> problem when the program was compiled with the 'makefile' which is
> recommended. Because I need some extra libraries, I have to use cmake.
> > > with ex3.c:
> > > yjwu@yjwu-XPS-8910:~/tem/build2$ make
> > > Scanning dependencies of target Test1
> > > [ 50%] Building C object CMakeFiles/Test1.dir/ex3.c.o
> > > [100%] Linking C executable Test1
> > > /usr/bin/ld: CMakeFiles/Test1.dir/ex3.c.o: undefined reference to
> symbol 'pow@@GLIBC_2.2.5'
> > > //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing
> from command line
> > > collect2: error: ld returned 1 exit status
> > > CMakeFiles/Test1.dir/build.make:94: recipe for target 'Test1' failed
> > > make[2]: *** [Test1] Error 1
> > > CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all'
> failed
> > > make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
> > > Makefile:83: recipe for target 'all' failed
> > > make: *** [all] Error 2
> > > with ex3.cpp:
> > > yjwu@yjwu-XPS-8910:~/tem/build2$ make
> > > Scanning dependencies of target Test1
> > > [ 50%] Building CXX object CMakeFiles/Test1.dir/ex3.cpp.o
> > > [100%] Linking CXX executable Test1
> > > /usr/bin/ld: CMakeFiles/Test1.dir/ex3.cpp.o: undefined reference to
> symbol 'MPI_Comm_rank'
> > > /home/yjwu/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/Test1.dir/build.make:94: recipe for target 'Test1' failed
> > > make[2]: *** [Test1] Error 1
> > > CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all'
> failed
> > > make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
> > > Makefile:83: recipe for target 'all' failed
> > > make: *** [all] Error 2
> > > Thanks,
> > > Yingjie
> > >
> > > Matthew Knepley  于2019年12月6日周五 下午11:46写道:
> > > It sounds like your C++ compiler is name mangling the symbol, but the
> library has no mangling.
> > > Why are you using C++.
> > >
> > >   Thanks,
> > >
> > > Matt
> > >
> > > On Fri, Dec 6, 2019 at 10:44 AM Yingjie Wu  wrote:
> > > 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
> > > -- 

Re: [petsc-users] CMake error in PETSc

2019-12-09 Thread Smith, Barry F.

   The problem is that your Cmake file knows nothing about the MPI compilers 
that are required and hence just selects some random compilers it found in the 
path which do not support MPI.

   I have attached a new CMakeList.txt for you to try.

   I uses the environmental variables PETSC_DIR and PETSC_ARCH to find the 
configuration file AND use the compilers from the configuration file. It works 
for me, please let me know if you have trouble.

   Barry



> On Dec 8, 2019, at 10:38 PM, Yingjie Wu  wrote:
>
> Thank you very much for your help.
> My programs are as follow
> Smith, Barry F.  于2019年12月9日周一 下午12:29写道:
>
>There is something missing in the cmake process that is causing needed 
> libraries not to be linked.
>
>Please email your program and your CMake stuff (files you use) so we can 
> reproduce the problem and find a fix.
>
>Barry
>
>
> > On Dec 8, 2019, at 10:06 PM, Yingjie Wu  wrote:
> >
> > Hi,
> > Thank you for your response.
> > This problem has not been solved. I've been reporting errors in the process 
> > of 'make'. The test example I used comes from: /snes /example 
> > /tutorials/ex3.c by modifying the suffix of ex3, there will be different 
> > error messages as following. I checked a lot of DSO problems on the 
> > Internet and installed a lot of libraries, but the error still haven't been 
> > solved. I was wondering if I was missing any prefix during the configure of 
> > PETSc(I use the simplest recommended installation), but there was no 
> > problem when the program was compiled with the 'makefile' which is 
> > recommended. Because I need some extra libraries, I have to use cmake.
> > with ex3.c:
> > yjwu@yjwu-XPS-8910:~/tem/build2$ make
> > Scanning dependencies of target Test1
> > [ 50%] Building C object CMakeFiles/Test1.dir/ex3.c.o
> > [100%] Linking C executable Test1
> > /usr/bin/ld: CMakeFiles/Test1.dir/ex3.c.o: undefined reference to symbol 
> > 'pow@@GLIBC_2.2.5'
> > //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from 
> > command line
> > collect2: error: ld returned 1 exit status
> > CMakeFiles/Test1.dir/build.make:94: recipe for target 'Test1' failed
> > make[2]: *** [Test1] Error 1
> > CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all' failed
> > make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
> > Makefile:83: recipe for target 'all' failed
> > make: *** [all] Error 2
> > with ex3.cpp:
> > yjwu@yjwu-XPS-8910:~/tem/build2$ make
> > Scanning dependencies of target Test1
> > [ 50%] Building CXX object CMakeFiles/Test1.dir/ex3.cpp.o
> > [100%] Linking CXX executable Test1
> > /usr/bin/ld: CMakeFiles/Test1.dir/ex3.cpp.o: undefined reference to symbol 
> > 'MPI_Comm_rank'
> > /home/yjwu/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/Test1.dir/build.make:94: recipe for target 'Test1' failed
> > make[2]: *** [Test1] Error 1
> > CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all' failed
> > make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
> > Makefile:83: recipe for target 'all' failed
> > make: *** [all] Error 2
> > Thanks,
> > Yingjie
> >
> > Matthew Knepley  于2019年12月6日周五 下午11:46写道:
> > It sounds like your C++ compiler is name mangling the symbol, but the 
> > library has no mangling.
> > Why are you using C++.
> >
> >   Thanks,
> >
> > Matt
> >
> > On Fri, Dec 6, 2019 at 10:44 AM Yingjie Wu  wrote:
> > 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 

Re: [petsc-users] CMake error in PETSc

2019-12-08 Thread Yingjie Wu
Thank you very much for your help.
My programs are as follows.

Smith, Barry F.  于2019年12月9日周一 下午12:29写道:

>
>There is something missing in the cmake process that is causing needed
> libraries not to be linked.
>
>Please email your program and your CMake stuff (files you use) so we
> can reproduce the problem and find a fix.
>
>Barry
>
>
> > On Dec 8, 2019, at 10:06 PM, Yingjie Wu  wrote:
> >
> > Hi,
> > Thank you for your response.
> > This problem has not been solved. I've been reporting errors in the
> process of 'make'. The test example I used comes from: /snes /example
> /tutorials/ex3.c by modifying the suffix of ex3, there will be different
> error messages as following. I checked a lot of DSO problems on the
> Internet and installed a lot of libraries, but the error still haven't been
> solved. I was wondering if I was missing any prefix during the configure of
> PETSc(I use the simplest recommended installation), but there was no
> problem when the program was compiled with the 'makefile' which is
> recommended. Because I need some extra libraries, I have to use cmake.
> > with ex3.c:
> > yjwu@yjwu-XPS-8910:~/tem/build2$ make
> > Scanning dependencies of target Test1
> > [ 50%] Building C object CMakeFiles/Test1.dir/ex3.c.o
> > [100%] Linking C executable Test1
> > /usr/bin/ld: CMakeFiles/Test1.dir/ex3.c.o: undefined reference to symbol
> 'pow@@GLIBC_2.2.5'
> > //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from
> command line
> > collect2: error: ld returned 1 exit status
> > CMakeFiles/Test1.dir/build.make:94: recipe for target 'Test1' failed
> > make[2]: *** [Test1] Error 1
> > CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all'
> failed
> > make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
> > Makefile:83: recipe for target 'all' failed
> > make: *** [all] Error 2
> > with ex3.cpp:
> > yjwu@yjwu-XPS-8910:~/tem/build2$ make
> > Scanning dependencies of target Test1
> > [ 50%] Building CXX object CMakeFiles/Test1.dir/ex3.cpp.o
> > [100%] Linking CXX executable Test1
> > /usr/bin/ld: CMakeFiles/Test1.dir/ex3.cpp.o: undefined reference to
> symbol 'MPI_Comm_rank'
> > /home/yjwu/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/Test1.dir/build.make:94: recipe for target 'Test1' failed
> > make[2]: *** [Test1] Error 1
> > CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all'
> failed
> > make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
> > Makefile:83: recipe for target 'all' failed
> > make: *** [all] Error 2
> > Thanks,
> > Yingjie
> >
> > Matthew Knepley  于2019年12月6日周五 下午11:46写道:
> > It sounds like your C++ compiler is name mangling the symbol, but the
> library has no mangling.
> > Why are you using C++.
> >
> >   Thanks,
> >
> > Matt
> >
> > On Fri, Dec 6, 2019 at 10:44 AM Yingjie Wu  wrote:
> > 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]: 

Re: [petsc-users] CMake error in PETSc

2019-12-08 Thread Smith, Barry F.

   There is something missing in the cmake process that is causing needed 
libraries not to be linked.

   Please email your program and your CMake stuff (files you use) so we can 
reproduce the problem and find a fix.

   Barry


> On Dec 8, 2019, at 10:06 PM, Yingjie Wu  wrote:
> 
> Hi,
> Thank you for your response. 
> This problem has not been solved. I've been reporting errors in the process 
> of 'make'. The test example I used comes from: /snes /example 
> /tutorials/ex3.c by modifying the suffix of ex3, there will be different 
> error messages as following. I checked a lot of DSO problems on the Internet 
> and installed a lot of libraries, but the error still haven't been solved. I 
> was wondering if I was missing any prefix during the configure of PETSc(I use 
> the simplest recommended installation), but there was no problem when the 
> program was compiled with the 'makefile' which is recommended. Because I need 
> some extra libraries, I have to use cmake.
> with ex3.c:
> yjwu@yjwu-XPS-8910:~/tem/build2$ make
> Scanning dependencies of target Test1
> [ 50%] Building C object CMakeFiles/Test1.dir/ex3.c.o
> [100%] Linking C executable Test1
> /usr/bin/ld: CMakeFiles/Test1.dir/ex3.c.o: undefined reference to symbol 
> 'pow@@GLIBC_2.2.5'
> //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from 
> command line
> collect2: error: ld returned 1 exit status
> CMakeFiles/Test1.dir/build.make:94: recipe for target 'Test1' failed
> make[2]: *** [Test1] Error 1
> CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all' failed
> make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
> Makefile:83: recipe for target 'all' failed
> make: *** [all] Error 2
> with ex3.cpp:
> yjwu@yjwu-XPS-8910:~/tem/build2$ make
> Scanning dependencies of target Test1
> [ 50%] Building CXX object CMakeFiles/Test1.dir/ex3.cpp.o
> [100%] Linking CXX executable Test1
> /usr/bin/ld: CMakeFiles/Test1.dir/ex3.cpp.o: undefined reference to symbol 
> 'MPI_Comm_rank'
> /home/yjwu/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/Test1.dir/build.make:94: recipe for target 'Test1' failed
> make[2]: *** [Test1] Error 1
> CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all' failed
> make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
> Makefile:83: recipe for target 'all' failed
> make: *** [all] Error 2
> Thanks,
> Yingjie
> 
> Matthew Knepley  于2019年12月6日周五 下午11:46写道:
> It sounds like your C++ compiler is name mangling the symbol, but the library 
> has no mangling.
> Why are you using C++.
> 
>   Thanks,
> 
> Matt
> 
> On Fri, Dec 6, 2019 at 10:44 AM Yingjie Wu  wrote:
> 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  

Re: [petsc-users] CMake error in PETSc

2019-12-08 Thread Yingjie Wu
Hi,
Thank you for your response.
This problem has not been solved. I've been reporting errors in the process
of 'make'. The test example I used comes from: /snes /example
/tutorials/ex3.c by modifying the suffix of ex3, there will be different
error messages as following. I checked a lot of DSO problems on the
Internet and installed a lot of libraries, but the error still haven't been
solved. I was wondering if I was missing any prefix during the configure of
PETSc(I use the simplest recommended installation), but there was no
problem when the program was compiled with the 'makefile' which is
recommended. Because I need some extra libraries, I have to use cmake.
with ex3.c:

yjwu@yjwu-XPS-8910:~/tem/build2$ make
Scanning dependencies of target Test1
[ 50%] Building C object CMakeFiles/Test1.dir/ex3.c.o
[100%] Linking C executable Test1
/usr/bin/ld: CMakeFiles/Test1.dir/ex3.c.o: undefined reference to symbol
'pow@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from
command line
collect2: error: ld returned 1 exit status
CMakeFiles/Test1.dir/build.make:94: recipe for target 'Test1' failed
make[2]: *** [Test1] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all' failed
make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

with ex3.cpp:

yjwu@yjwu-XPS-8910:~/tem/build2$ make
Scanning dependencies of target Test1
[ 50%] Building CXX object CMakeFiles/Test1.dir/ex3.cpp.o
[100%] Linking CXX executable Test1
/usr/bin/ld: CMakeFiles/Test1.dir/ex3.cpp.o: undefined reference to symbol
'MPI_Comm_rank'
/home/yjwu/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/Test1.dir/build.make:94: recipe for target 'Test1' failed
make[2]: *** [Test1] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test1.dir/all' failed
make[1]: *** [CMakeFiles/Test1.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Thanks,
Yingjie

Matthew Knepley  于2019年12月6日周五 下午11:46写道:

> It sounds like your C++ compiler is name mangling the symbol, but the
> library has no mangling.
> Why are you using C++.
>
>   Thanks,
>
> Matt
>
> On Fri, Dec 6, 2019 at 10:44 AM Yingjie Wu  wrote:
>
>> 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  于2019年12月6日周五 上午10:54写道:
>>
>>> Yingjie Wu  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 

Re: [petsc-users] CMake error in PETSc

2019-12-06 Thread Matthew Knepley
It sounds like your C++ compiler is name mangling the symbol, but the
library has no mangling.
Why are you using C++.

  Thanks,

Matt

On Fri, Dec 6, 2019 at 10:44 AM Yingjie Wu  wrote:

> 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  于2019年12月6日周五 上午10:54写道:
>
>> Yingjie Wu  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?
>>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] CMake error in PETSc

2019-12-06 Thread Yingjie Wu
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  于2019年12月6日周五 上午10:54写道:

> Yingjie Wu  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?
>


Re: [petsc-users] CMake error in PETSc

2019-12-05 Thread Jed Brown
Yingjie Wu  writes:

> Hi,
>
> I installed the latest version of petsc, and compiled the example using
> cmke as described above. Compilation can be done, but there is a new
> problem while the program is running, as if the program could not find the
> shared library libpetsc.so.3.12. How can I solve this problem? 

Either

  export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib

or set RPATH in CMake:

  https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling

CMake's FindPkgConfig punts on this front (and it's sadly complicated,
but they broke their own conventions to get here).  It's been 10 years
and they've had no interest in fixing some of the problems that my
modules were created to handle.  I stopped using CMake by choice long
ago so I'd prefer to gently steer people toward something
(FindPkgConfig) that I'm not on the hook to maintain.


Re: [petsc-users] CMake error in PETSc

2019-12-05 Thread Jed Brown
Yingjie Wu  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?


Re: [petsc-users] CMake error in PETSc

2019-12-05 Thread Yingjie Wu
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.

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?


Thank you for your response.

Yingjie




Yingjie Wu  于2019年12月5日周四 下午9:25写道:

> Hi,
>
> I installed the latest version of petsc, and compiled the example using
> cmke as described above. Compilation can be done, but there is a new
> problem while the program is running, as if the program could not find the
> shared library libpetsc.so.3.12. How can I solve this problem? The details
> are as follows:
>
> lerui@yu1994-ThinkPad-W520:~/tem$ cat CMakeLists.txt
> #This is a CMake makefile.
> cmake_minimum_required(VERSION 2.8.11)
>
> project(example01cmke)
>
> add_executable(example01cmke ex1.cpp)
>
> find_package(PkgConfig REQUIRED)
>
> set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
>
> pkg_search_module(PETSC REQUIRED PETSc)
>
> message("pkg include dirs: ${PETSC_INCLUDE_DIRS}")
>
> message("pkg include libs: ${PETSC_LIBRARIES}")
>
> message("pkg ldflags: ${PETSC_LDFLAGS}")
>
> include_directories(${PETSC_INCLUDE_DIRS})
>
> target_link_libraries(example01cmke ${PETSC_LDFLAGS})
>
> lerui@yu1994-ThinkPad-W520:~/tem$ mkdir build
> lerui@yu1994-ThinkPad-W520:~/tem$ cd build/
> lerui@yu1994-ThinkPad-W520:~/tem/build$
> PKG_CONFIG_PATH=$PETSC_DIR/$PETSC_ARCH/lib/pkgconfig 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/tem/build
> lerui@yu1994-ThinkPad-W520:~/tem/build$ make
> Scanning dependencies of target example01cmke
> [ 50%] Building CXX object CMakeFiles/example01cmke.dir/ex1.cpp.o
> [100%] Linking CXX executable example01cmke
> [100%] Built target example01cmke
> lerui@yu1994-ThinkPad-W520:~/tem/build$ mpiexec -n 1 ./example01cmke
> -snes_monitor
> ./example01cmke: error while loading shared libraries: libpetsc.so.3.12:
> cannot open shared object file: No such file or directory
> ---
> Primary job  terminated normally, but 1 process returned
> a non-zero exit code.. Per user-direction, the job has been aborted.
> ---
> --
> mpiexec detected that one or more processes exited with non-zero status,
> thus causing
> the job to be terminated. The first process to do so was:
>
>   Process name: [[6716,1],0]
>   Exit code:127
> --
>
> Thanks,
> Yingjie
>
> Jed Brown  于2019年12月5日周四 下午1:17写道:
>
>> Yingjie Wu  writes:
>>
>> > Hi,
>> > I tried to use PKG to find the library file of PETSc, but there were
>> some
>> > errors. Because I am not very familiar with cmake, I refer to different
>> PKG
>> > tutorials. My CMakeList.txt is as follows. I don't know how to solve
>> this
>> > error message, please give me some suggestions.
>> >
>> > yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ cat CMakeLists.txt
>> > #This is a CMake makefile.
>> > cmake_minimum_required(VERSION 2.8.11)
>> >
>> > project(example01cmke)
>> >
>> > add_executable(example01cmke ex1.cpp)
>> >
>> > find_package(PkgConfig REQUIRED)
>> >
>> > message("petsc directories: ${PETSC_DIR}")
>> >
>> > message("petsc arch: ${PETSC_ARCH}")
>> >
>> > set(ENV{PKG_CONFIG_PATH}
>> > /home/yjwu/petsc-3.10.1/arch-linux2-c-debug/lib/pkgconfig)
>> >
>> > pkg_search_module(PETSC REQUIRED PETSc)
>> >
>> > message("pkg include dirs: ${PETSC_INCLUDE_DIRS}")
>> >
>> > message("pkg include libs: ${PETSC_LIBRARIES}")
>> >
>> > message("pkg ldflags: ${PETSC_LDFLAGS}")
>> >
>> > include_directories(${PETSC_INCLUDE_DIRS})
>> >
>> > target_link_libraries(example01cmke ${PETSC_LDFLAGS})
>> >
>> 

Re: [petsc-users] CMake error in PETSc

2019-12-05 Thread Yingjie Wu
Hi,

I installed the latest version of petsc, and compiled the example using
cmke as described above. Compilation can be done, but there is a new
problem while the program is running, as if the program could not find the
shared library libpetsc.so.3.12. How can I solve this problem? The details
are as follows:

lerui@yu1994-ThinkPad-W520:~/tem$ cat CMakeLists.txt
#This is a CMake makefile.
cmake_minimum_required(VERSION 2.8.11)

project(example01cmke)

add_executable(example01cmke ex1.cpp)

find_package(PkgConfig REQUIRED)

set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

pkg_search_module(PETSC REQUIRED PETSc)

message("pkg include dirs: ${PETSC_INCLUDE_DIRS}")

message("pkg include libs: ${PETSC_LIBRARIES}")

message("pkg ldflags: ${PETSC_LDFLAGS}")

include_directories(${PETSC_INCLUDE_DIRS})

target_link_libraries(example01cmke ${PETSC_LDFLAGS})

lerui@yu1994-ThinkPad-W520:~/tem$ mkdir build
lerui@yu1994-ThinkPad-W520:~/tem$ cd build/
lerui@yu1994-ThinkPad-W520:~/tem/build$
PKG_CONFIG_PATH=$PETSC_DIR/$PETSC_ARCH/lib/pkgconfig 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/tem/build
lerui@yu1994-ThinkPad-W520:~/tem/build$ make
Scanning dependencies of target example01cmke
[ 50%] Building CXX object CMakeFiles/example01cmke.dir/ex1.cpp.o
[100%] Linking CXX executable example01cmke
[100%] Built target example01cmke
lerui@yu1994-ThinkPad-W520:~/tem/build$ mpiexec -n 1 ./example01cmke
-snes_monitor
./example01cmke: error while loading shared libraries: libpetsc.so.3.12:
cannot open shared object file: No such file or directory
---
Primary job  terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
---
--
mpiexec detected that one or more processes exited with non-zero status,
thus causing
the job to be terminated. The first process to do so was:

  Process name: [[6716,1],0]
  Exit code:127
--

Thanks,
Yingjie

Jed Brown  于2019年12月5日周四 下午1:17写道:

> Yingjie Wu  writes:
>
> > Hi,
> > I tried to use PKG to find the library file of PETSc, but there were some
> > errors. Because I am not very familiar with cmake, I refer to different
> PKG
> > tutorials. My CMakeList.txt is as follows. I don't know how to solve this
> > error message, please give me some suggestions.
> >
> > yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ cat CMakeLists.txt
> > #This is a CMake makefile.
> > cmake_minimum_required(VERSION 2.8.11)
> >
> > project(example01cmke)
> >
> > add_executable(example01cmke ex1.cpp)
> >
> > find_package(PkgConfig REQUIRED)
> >
> > message("petsc directories: ${PETSC_DIR}")
> >
> > message("petsc arch: ${PETSC_ARCH}")
> >
> > set(ENV{PKG_CONFIG_PATH}
> > /home/yjwu/petsc-3.10.1/arch-linux2-c-debug/lib/pkgconfig)
> >
> > pkg_search_module(PETSC REQUIRED PETSc)
> >
> > message("pkg include dirs: ${PETSC_INCLUDE_DIRS}")
> >
> > message("pkg include libs: ${PETSC_LIBRARIES}")
> >
> > message("pkg ldflags: ${PETSC_LDFLAGS}")
> >
> > include_directories(${PETSC_INCLUDE_DIRS})
> >
> > target_link_libraries(example01cmke ${PETSC_LDFLAGS})
> >
> > yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ cd build/
> > yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ 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 

Re: [petsc-users] CMake error in PETSc

2019-12-04 Thread Jed Brown
Yingjie Wu  writes:

> Hi,
> I tried to use PKG to find the library file of PETSc, but there were some
> errors. Because I am not very familiar with cmake, I refer to different PKG
> tutorials. My CMakeList.txt is as follows. I don't know how to solve this
> error message, please give me some suggestions.
>
> yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ cat CMakeLists.txt
> #This is a CMake makefile.
> cmake_minimum_required(VERSION 2.8.11)
>
> project(example01cmke)
>
> add_executable(example01cmke ex1.cpp)
>
> find_package(PkgConfig REQUIRED)
>
> message("petsc directories: ${PETSC_DIR}")
>
> message("petsc arch: ${PETSC_ARCH}")
>
> set(ENV{PKG_CONFIG_PATH}
> /home/yjwu/petsc-3.10.1/arch-linux2-c-debug/lib/pkgconfig)
>
> pkg_search_module(PETSC REQUIRED PETSc)
>
> message("pkg include dirs: ${PETSC_INCLUDE_DIRS}")
>
> message("pkg include libs: ${PETSC_LIBRARIES}")
>
> message("pkg ldflags: ${PETSC_LDFLAGS}")
>
> include_directories(${PETSC_INCLUDE_DIRS})
>
> target_link_libraries(example01cmke ${PETSC_LDFLAGS})
>
> yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ cd build/
> yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ 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")
> petsc directories:
> petsc arch:
> -- Checking for one of the modules 'PETSc'
> pkg include dirs:
> /home/yjwu/petsc-3.10.1/include;/home/yjwu/petsc-3.10.1/arch-linux2-c-debug/include
> pkg include libs: petsc
> pkg ldflags: -L/home/yjwu/petsc-3.10.1/lib;-lpetsc
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/yjwu/PETSctest/Testcmake/build
> yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ make
> Scanning dependencies of target example01cmke
> [ 50%] Building CXX object CMakeFiles/example01cmke.dir/ex1.cpp.o
> [100%] Linking CXX executable example01cmke
> /usr/bin/ld: cannot find -lpetsc
> collect2: error: ld returned 1 exit status

Is your PETSc fully built/installed, or just configured?

I just tested with this simplified file

cmake_minimum_required(VERSION 2.8.11)
project(example01cmke)

add_executable(example01cmke ex1.cpp)

find_package(PkgConfig REQUIRED)
pkg_search_module(PETSC REQUIRED PETSc)
message("pkg include dirs: ${PETSC_INCLUDE_DIRS}")
message("pkg include libs: ${PETSC_LIBRARIES}")
message("pkg ldflags: ${PETSC_LDFLAGS}")

include_directories(${PETSC_INCLUDE_DIRS})
target_link_libraries(example01cmke ${PETSC_LDFLAGS})


$ PKG_CONFIG_PATH=$PETSC_DIR/$PETSC_ARCH/lib/pkgconfig cmake ..
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /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: /bin/c++
-- Check for working CXX compiler: /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: /bin/pkg-config (found version "1.6.3") 
-- Checking for one of the modules 'PETSc'
pkg include dirs: /home/jed/petsc/ompi-optg/include;/home/jed/petsc/include
pkg include libs: petsc
pkg ldflags: -L/home/jed/petsc/ompi-optg/lib;-lpetsc
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/jed/build
22:12 jedjoule12  /tmp/jed/build$ make
Scanning dependencies of target example01cmke
[ 50%] Building CXX object CMakeFiles/example01cmke.dir/ex1.cpp.o
[100%] Linking CXX executable example01cmke
[100%] Built target example01cmke


Note that you may need to set RPATH (in CMake) or export a suitable
LD_LIBRARY_PATH if your PETSc is in a non-standard location.


Re: [petsc-users] CMake error in PETSc

2019-12-04 Thread Yingjie Wu
Hi,
I tried to use PKG to find the library file of PETSc, but there were some
errors. Because I am not very familiar with cmake, I refer to different PKG
tutorials. My CMakeList.txt is as follows. I don't know how to solve this
error message, please give me some suggestions.

yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ cat CMakeLists.txt
#This is a CMake makefile.
cmake_minimum_required(VERSION 2.8.11)

project(example01cmke)

add_executable(example01cmke ex1.cpp)

find_package(PkgConfig REQUIRED)

message("petsc directories: ${PETSC_DIR}")

message("petsc arch: ${PETSC_ARCH}")

set(ENV{PKG_CONFIG_PATH}
/home/yjwu/petsc-3.10.1/arch-linux2-c-debug/lib/pkgconfig)

pkg_search_module(PETSC REQUIRED PETSc)

message("pkg include dirs: ${PETSC_INCLUDE_DIRS}")

message("pkg include libs: ${PETSC_LIBRARIES}")

message("pkg ldflags: ${PETSC_LDFLAGS}")

include_directories(${PETSC_INCLUDE_DIRS})

target_link_libraries(example01cmke ${PETSC_LDFLAGS})

yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ cd build/
yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ 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")
petsc directories:
petsc arch:
-- Checking for one of the modules 'PETSc'
pkg include dirs:
/home/yjwu/petsc-3.10.1/include;/home/yjwu/petsc-3.10.1/arch-linux2-c-debug/include
pkg include libs: petsc
pkg ldflags: -L/home/yjwu/petsc-3.10.1/lib;-lpetsc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yjwu/PETSctest/Testcmake/build
yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ make
Scanning dependencies of target example01cmke
[ 50%] Building CXX object CMakeFiles/example01cmke.dir/ex1.cpp.o
[100%] Linking CXX executable example01cmke
/usr/bin/ld: cannot find -lpetsc
collect2: error: ld returned 1 exit status
CMakeFiles/example01cmke.dir/build.make:94: recipe for target
'example01cmke' failed
make[2]: *** [example01cmke] Error 1
CMakeFiles/Makefile2:67: recipe for target
'CMakeFiles/example01cmke.dir/all' failed
make[1]: *** [CMakeFiles/example01cmke.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2


Thanks,
Yingjie


Jed Brown  于2019年12月5日周四 上午12:05写道:

> Yingjie Wu  writes:
>
> > Thank you for your response.
> >
> > I have two questions about using FindPkgConfig:
> >
> >
> >1. Is there any requirement for petsc version using FindPkgConfig? I'm
> >using an older version 3.10.1.
>
> 3.10 should be sufficient (though we recommend upgrading).
>
> >2. Does the use of FindPkgConfig only require the following commands
> and
> >does not require any scripts?
>
> Correct, no scripts.
>
> > find_package(PkgConfig REQUIRED)
> >
> > pkg_search_module (PETSC REQUIRED PETSc)
> >
> > target_link_libraries(testapp ${PETSC_LIBRARIES})
> >
> > target_link_includes(testapp ${PETSC_INCLUDE_DIRS})
> >
> > Since I just came into contact with cmake, I really need some help.
> >
> >
> > Thanks,
> >
> > Yingjie
> >
> >
> > Jed Brown  于2019年12月4日周三 下午11:31写道:
> >
> >> Yingjie Wu  writes:
> >>
> >> > Dear Petsc developers
> >> > Hi,
> >> > Because I use some external library files, I want to compile the PETSc
> >> > program with CMake. I follow the library search program
> >> >
> >>
> https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt
> >> > recommended
> >> > on GitHub. And wrote a cmakelist.txt:
> >> >
> >> > cmake_minimum_required(VERSION 2.8.11)
> >> > project(example01cmke)
> >> > add_executable(example01cmke ex1.cpp)
> >> > set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
> >> > find_package(PETSc)
> >> > include_directories(${PETSC_INCLUDE_DIR})
> >>
> >> This needs to be spelled PETSC_INCLUDES, as stated in FindPETSc.cmake.
> >>
> >> These days, I usually recommend that people use
> >>
> >> https://cmake.org/cmake/help/latest/module/FindPkgConfig.html
> >>
> >> instead of my FindPETSc.cmake because its simpler and doesn't require
> >> the script (which was developed before we added pkg-config support to
> >> PETSc).
> >>
>


Re: [petsc-users] CMake error in PETSc

2019-12-04 Thread Jed Brown
Yingjie Wu  writes:

> Thank you for your response.
>
> I have two questions about using FindPkgConfig:
>
>
>1. Is there any requirement for petsc version using FindPkgConfig? I'm
>using an older version 3.10.1.

3.10 should be sufficient (though we recommend upgrading).

>2. Does the use of FindPkgConfig only require the following commands and
>does not require any scripts?

Correct, no scripts.

> find_package(PkgConfig REQUIRED)
>
> pkg_search_module (PETSC REQUIRED PETSc)
>
> target_link_libraries(testapp ${PETSC_LIBRARIES})
>
> target_link_includes(testapp ${PETSC_INCLUDE_DIRS})
>
> Since I just came into contact with cmake, I really need some help.
>
>
> Thanks,
>
> Yingjie
>
>
> Jed Brown  于2019年12月4日周三 下午11:31写道:
>
>> Yingjie Wu  writes:
>>
>> > Dear Petsc developers
>> > Hi,
>> > Because I use some external library files, I want to compile the PETSc
>> > program with CMake. I follow the library search program
>> >
>> https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt
>> > recommended
>> > on GitHub. And wrote a cmakelist.txt:
>> >
>> > cmake_minimum_required(VERSION 2.8.11)
>> > project(example01cmke)
>> > add_executable(example01cmke ex1.cpp)
>> > set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
>> > find_package(PETSc)
>> > include_directories(${PETSC_INCLUDE_DIR})
>>
>> This needs to be spelled PETSC_INCLUDES, as stated in FindPETSc.cmake.
>>
>> These days, I usually recommend that people use
>>
>> https://cmake.org/cmake/help/latest/module/FindPkgConfig.html
>>
>> instead of my FindPETSc.cmake because its simpler and doesn't require
>> the script (which was developed before we added pkg-config support to
>> PETSc).
>>


Re: [petsc-users] CMake error in PETSc

2019-12-04 Thread Yingjie Wu
Thank you for your response.

I have two questions about using FindPkgConfig:


   1. Is there any requirement for petsc version using FindPkgConfig? I'm
   using an older version 3.10.1.
   2. Does the use of FindPkgConfig only require the following commands and
   does not require any scripts?

find_package(PkgConfig REQUIRED)

pkg_search_module (PETSC REQUIRED PETSc)

target_link_libraries(testapp ${PETSC_LIBRARIES})

target_link_includes(testapp ${PETSC_INCLUDE_DIRS})

Since I just came into contact with cmake, I really need some help.


Thanks,

Yingjie


Jed Brown  于2019年12月4日周三 下午11:31写道:

> Yingjie Wu  writes:
>
> > Dear Petsc developers
> > Hi,
> > Because I use some external library files, I want to compile the PETSc
> > program with CMake. I follow the library search program
> >
> https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt
> > recommended
> > on GitHub. And wrote a cmakelist.txt:
> >
> > cmake_minimum_required(VERSION 2.8.11)
> > project(example01cmke)
> > add_executable(example01cmke ex1.cpp)
> > set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
> > find_package(PETSc)
> > include_directories(${PETSC_INCLUDE_DIR})
>
> This needs to be spelled PETSC_INCLUDES, as stated in FindPETSc.cmake.
>
> These days, I usually recommend that people use
>
> https://cmake.org/cmake/help/latest/module/FindPkgConfig.html
>
> instead of my FindPETSc.cmake because its simpler and doesn't require
> the script (which was developed before we added pkg-config support to
> PETSc).
>


Re: [petsc-users] CMake error in PETSc

2019-12-04 Thread Jed Brown
Yingjie Wu  writes:

> Dear Petsc developers
> Hi,
> Because I use some external library files, I want to compile the PETSc
> program with CMake. I follow the library search program
> https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt
> recommended
> on GitHub. And wrote a cmakelist.txt:
>
> cmake_minimum_required(VERSION 2.8.11)
> project(example01cmke)
> add_executable(example01cmke ex1.cpp)
> set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
> find_package(PETSc)
> include_directories(${PETSC_INCLUDE_DIR})

This needs to be spelled PETSC_INCLUDES, as stated in FindPETSc.cmake.

These days, I usually recommend that people use

https://cmake.org/cmake/help/latest/module/FindPkgConfig.html

instead of my FindPETSc.cmake because its simpler and doesn't require
the script (which was developed before we added pkg-config support to
PETSc).


Re: [petsc-users] CMake error in PETSc

2019-12-04 Thread Yingjie Wu
Hi,
I feel very sorry because I sent the wrong site.  I fork the module:
https://github.com/jedbrown/cmake-modules

Thanks,
Yingjie

Yingjie Wu  于2019年12月4日周三 下午11:14写道:

> Dear Petsc developers
> Hi,
> Because I use some external library files, I want to compile the PETSc
> program with CMake. I follow the library search program
> https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt
>  recommended
> on GitHub. And wrote a cmakelist.txt:
>
> cmake_minimum_required(VERSION 2.8.11)
> project(example01cmke)
> add_executable(example01cmke ex1.cpp)
> set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
> find_package(PETSc)
> include_directories(${PETSC_INCLUDE_DIR})
> target_link_libraries(example01cmke ${PETSC_LIBRARIES})
>
> My document relationships are:
>
> yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ tree
> .
> ├── build
> ├── cmake
> │   └── modules
> │   ├── CorrectWindowsPaths.cmake
> │   ├── FindFFTW.cmake
> │   ├── FindGit.cmake
> │   ├── FindGSL.cmake
> │   ├── FindITAPS.cmake
> │   ├── FindNetCDF.cmake
> │   ├── FindPackageMultipass.cmake
> │   ├── FindPETSc.cmake
> │   ├── LICENSE
> │   ├── README
> │   └── ResolveCompilerPaths.cmake
> ├── CMakeLists.txt
> └── ex1.cpp
>
>  After compiling with cmake.. and make, there is an error message:
>
>
> yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ 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
> -- petsc_lib_dir /home/yjwu/petsc-3.10.1/arch-linux2-c-debug/lib
> -- Recognized PETSc install with single library for all packages
> -- Performing Test MULTIPASS_TEST_1_petsc_works_minimal
> -- Performing Test MULTIPASS_TEST_1_petsc_works_minimal - Success
> -- Minimal PETSc includes and libraries work.  This probably means we are
> building with shared libs.
> -- Found PETSc:
> /home/yjwu/petsc-3.10.1/arch-linux2-c-debug/include;/home/yjwu/petsc-3.10.1/include
> (found version "3.10.1")
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/yjwu/PETSctest/Testcmake/build
> yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ make
> Scanning dependencies of target example01cmke
> [ 50%] Building CXX object CMakeFiles/example01cmke.dir/ex1.cpp.o
> In file included from /home/yjwu/petsc-3.10.1/include/petscis.h:7:0,
>  from /home/yjwu/petsc-3.10.1/include/petscvec.h:9,
>  from /home/yjwu/petsc-3.10.1/include/petscmat.h:6,
>  from /home/yjwu/petsc-3.10.1/include/petscpc.h:6,
>  from /home/yjwu/petsc-3.10.1/include/petscksp.h:6,
>  from /home/yjwu/petsc-3.10.1/include/petscsnes.h:6,
>  from /home/yjwu/PETSctest/Testcmake/ex1.cpp:29:
> /home/yjwu/petsc-3.10.1/include/petscsys.h:14:23: fatal error:
> petscconf.h: No such file or directory
> compilation terminated.
> CMakeFiles/example01cmke.dir/build.make:62: recipe for target
> 'CMakeFiles/example01cmke.dir/ex1.cpp.o' failed
> make[2]: *** [CMakeFiles/example01cmke.dir/ex1.cpp.o] Error 1
> CMakeFiles/Makefile2:67: recipe for target
> 'CMakeFiles/example01cmke.dir/all' failed
> make[1]: *** [CMakeFiles/example01cmke.dir/all] Error 2
> Makefile:83: recipe for target 'all' failed
> make: *** [all] Error 2
>
> I don't know how to solve this problem,ex1.cpp is the first example in
> SNES tutorial, please give me some advice.
>
> Best regards,
> Yingjie
>


[petsc-users] CMake error in PETSc

2019-12-04 Thread Yingjie Wu
Dear Petsc developers
Hi,
Because I use some external library files, I want to compile the PETSc
program with CMake. I follow the library search program
https://github.com/CoolProp/CoolProp/blob/b493de51a44078e4f5bbb8712e89305fd91f8b85/CMakeLists.txt
recommended
on GitHub. And wrote a cmakelist.txt:

cmake_minimum_required(VERSION 2.8.11)
project(example01cmke)
add_executable(example01cmke ex1.cpp)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
find_package(PETSc)
include_directories(${PETSC_INCLUDE_DIR})
target_link_libraries(example01cmke ${PETSC_LIBRARIES})

My document relationships are:

yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake$ tree
.
├── build
├── cmake
│   └── modules
│   ├── CorrectWindowsPaths.cmake
│   ├── FindFFTW.cmake
│   ├── FindGit.cmake
│   ├── FindGSL.cmake
│   ├── FindITAPS.cmake
│   ├── FindNetCDF.cmake
│   ├── FindPackageMultipass.cmake
│   ├── FindPETSc.cmake
│   ├── LICENSE
│   ├── README
│   └── ResolveCompilerPaths.cmake
├── CMakeLists.txt
└── ex1.cpp

 After compiling with cmake.. and make, there is an error message:


yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ 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
-- petsc_lib_dir /home/yjwu/petsc-3.10.1/arch-linux2-c-debug/lib
-- Recognized PETSc install with single library for all packages
-- Performing Test MULTIPASS_TEST_1_petsc_works_minimal
-- Performing Test MULTIPASS_TEST_1_petsc_works_minimal - Success
-- Minimal PETSc includes and libraries work.  This probably means we are
building with shared libs.
-- Found PETSc:
/home/yjwu/petsc-3.10.1/arch-linux2-c-debug/include;/home/yjwu/petsc-3.10.1/include
(found version "3.10.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/yjwu/PETSctest/Testcmake/build
yjwu@yjwu-XPS-8910:~/PETSctest/Testcmake/build$ make
Scanning dependencies of target example01cmke
[ 50%] Building CXX object CMakeFiles/example01cmke.dir/ex1.cpp.o
In file included from /home/yjwu/petsc-3.10.1/include/petscis.h:7:0,
 from /home/yjwu/petsc-3.10.1/include/petscvec.h:9,
 from /home/yjwu/petsc-3.10.1/include/petscmat.h:6,
 from /home/yjwu/petsc-3.10.1/include/petscpc.h:6,
 from /home/yjwu/petsc-3.10.1/include/petscksp.h:6,
 from /home/yjwu/petsc-3.10.1/include/petscsnes.h:6,
 from /home/yjwu/PETSctest/Testcmake/ex1.cpp:29:
/home/yjwu/petsc-3.10.1/include/petscsys.h:14:23: fatal error: petscconf.h:
No such file or directory
compilation terminated.
CMakeFiles/example01cmke.dir/build.make:62: recipe for target
'CMakeFiles/example01cmke.dir/ex1.cpp.o' failed
make[2]: *** [CMakeFiles/example01cmke.dir/ex1.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target
'CMakeFiles/example01cmke.dir/all' failed
make[1]: *** [CMakeFiles/example01cmke.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I don't know how to solve this problem,ex1.cpp is the first example in SNES
tutorial, please give me some advice.

Best regards,
Yingjie