构建caffe,错误链接google :: protobuf,Debian 9.1

时间:2017-10-24 06:50:11

标签: build protocol-buffers linker-errors caffe protoc

我有这个问题,我正在尝试在debian机器上构建caffe,我将构建所有内容但最后在链接时我得到多个未定义的引用google :: protobuf :: ...

我使用构建日志附加文件,其中包含错误消息(build_caffe.txt)。 libprotobuf-dev和protoc都已安装。 (dpkg -s的输出在proto.txt中)

以下是我如何建立咖啡。

export CXX=g++-4.9
export CC=gcc-4.9
cmake -D CUDA_HOST_COMPILER=/usr/bin/x86_64-linux-gnu-gcc-4.9 -D CUDA_USE_STATIC_CUDA_RUNTIME=OFF ..
make all

有人知道这个问题的解决方案吗?

proto.txt

build_caffe.txt

1 个答案:

答案 0 :(得分:0)

看起来你的protobuf是使用不同版本的gcc编译的。尝试从您的系统中删除protobuf并使用您想要用于Caffe的相同gcc版本从源安装它。 (/usr/bin/x86_64-linux-gnu-gcc-4.9根据你的命令)。
编辑:
如果您无法安装更新的protobuf,请编辑$ CAFFE_ROOT / cmake / ProtoBuf.cmake并进行以下更改:

#find_package( Protobuf REQUIRED ) # 1. Comment out this line
# 2. explicitly define protobuf's directories
set(PROTOBUF_INCLUDE_DIR path_to_protobuf/src/google/protobuf)
set(PROTOBUF_LIBRARIES path_to_where_protobuf_libs_are_built_to)
# 3. Explicitly set the full path to protoc executable
set(PROTOBUF_PROTOC_EXECUTABLE path_to_where_the_new_protoc_executable_is_build_to)
# ... Continue as usual
list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${PROTOBUF_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS PUBLIC ${PROTOBUF_LIBRARIES})
#...