caffe2编译问题

[ 93%] Linking CXX executable ../bin/mpi_test
/usr/bin/ld: CMakeFiles/mpi_test.dir/mpi/mpi_test.cc.o: undefined reference to symbol '_ZN3MPI8Datatype4FreeEv'
//usr/lib/libmpi_cxx.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/mpi_test.dir/build.make:100: recipe for target 'bin/mpi_test' failed
make[3]: *** [bin/mpi_test] Error 1
make[3]: Leaving directory '/home/suda/caffe2/build'
CMakeFiles/Makefile2:2750: recipe for target 'caffe2/CMakeFiles/mpi_test.dir/all' failed
make[2]: *** [caffe2/CMakeFiles/mpi_test.dir/all] Error 2
make[2]: Leaving directory '/home/suda/caffe2/build'
Makefile:138: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/suda/caffe2/build'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2

 
已邀请:

PangDeGui - 人脸、主动学习、职场新人

赞同来自: CatherineW

CMakeLists.txt里面加上
SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
include_directories(MPI_INCLUDE_PATH)
target_link_libraries(mytest ${MPI_LIBRARIES})
 
原帖:http://blog.csdn.net/qq_235413 ... 48186

Jiang先森 - 90后博士生

赞同来自:

朋友你好,为什么我在CMakeLists.txt里面最后加上这四句话,编译还是报错,报错如下:
CMake Error at CMakeLists.txt:291 (target_link_libraries):
  Cannot specify link libraries for target "mytest" which is not built by
  this project.


-- Configuring incomplete, errors occurred!
See also "/home/jiangyi/caffe2/build/CMakeFiles/CMakeOutput.log".
See also "/home/jiangyi/caffe2/build/CMakeFiles/CMakeError.log".

请问下怎么解决这个问题?

要回复问题请先登录注册