Ubantu 16 搭建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'

在caffe2\caffe2\CMakeLists.txt文件中添加

SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
include_directories(MPI_INCLUDE_PATH)

target_link_libraries(mpi_test ${MPI_LIBRARIES})

# ---[ Test binaries.
if (BUILD_TEST)
  set(Caffe2_ALL_TEST_SRCS ${Caffe2_CPU_TEST_SRCS})
  if (USE_CUDA)
    list(APPEND Caffe2_ALL_TEST_SRCS ${Caffe2_GPU_TEST_SRCS})
  endif()

  foreach(test_src ${Caffe2_ALL_TEST_SRCS})
    get_filename_component(test_name ${test_src} NAME_WE)
    add_executable(${test_name} "${test_src}")
    # For tests, some of the test code actually directly call the dependent
    # libraries even if they are not part of the public dependency libs. As a
    # result, we will explicitly link the test against the Caffe2 dependency
    # libs.
    target_link_libraries(${test_name} ${Caffe2_MAIN_LIBS} gtest_main)
    if (USE_CUDA)
      target_link_libraries(${test_name} ${Caffe2_CUDA_DEPENDENCY_LIBS})
    endif()
    if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.0)
      target_compile_features(${test_name} PRIVATE cxx_range_for)
    endif()
    add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
    install(TARGETS ${test_name} DESTINATION test)
  endforeach()
endif()

#--
SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
include_directories(MPI_INCLUDE_PATH)
target_link_libraries(mpi_test ${MPI_LIBRARIES})
[ 92%] Linking CXX executable ../bin/make_image_db
CMakeFiles/make_image_db.dir/make_image_db.cc.o:在函数‘caffe2::Converter::run()’中:
make_image_db.cc:(.text._ZN6caffe29Converter3runEv[_ZN6caffe29Converter3runEv]+0x2ce):对‘cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)’未定义的引用
collect2: error: ld returned 1 exit status
binaries/CMakeFiles/make_image_db.dir/build.make:102: recipe for target 'bin/make_image_db' failed

Opencv版本不匹配,为caffe2指定一个可用的版本

在caffe2\CMakeLists.txt文件中添加

set(OpenCV_DIR "/home/jimmy/3d/ls/opencv-3.2.0/build")
# ---[ Project and semantic versioning.
project(Caffe2 CXX C)

#--
set(OpenCV_DIR "/home/jimmy/3d/ls/opencv-3.2.0/build")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值