在我的Ubuntu 17.04上安装(编译)带有make
的Caffe(第一个版本)期间,我收到以下错误:
.build_release / lib / libcaffe.so:未定义的引用 `谷歌:: protobuf的内部:: :: WireFormatLite ::的ReadBytes(谷歌:: protobuf的:: IO :: CodedInputStream * 的std :: string *)'
.build_release / lib / libcaffe.so:未定义的引用 `google :: protobuf :: Message :: InitializationErrorString()const' collect2:错误:ld返回1退出状态Makefile:628:recipe for 目标'.build_release / tools / compute_image_mean.bin'失败
make:*** [.build_release / tools / compute_image_mean.bin]错误1
我的电脑规格如下:
$ nvcc -V
> nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA
> Corporation Built on Tue_Jan_10_13:22:03_CST_2017 Cuda compilation
> tools, release 8.0, V8.0.61
使用过的gcc:
$ sudo update-alternatives --config gcc
There are 4 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/gcc-4.9 10 auto mode
1 /usr/bin/g++-4.9 10 manual mode
* 2 /usr/bin/gcc-4.9 10 manual mode
3 /usr/bin/gcc-5 10 manual mode
4 /usr/bin/gcc-6 10 manual mode
OpenCV版本:
$ pkg-config --modversion opencv
3.2.0
我已经添加了关于official website的以下内容,并将Makefile.config修改为:
USE_CUDNN := 1
OPENCV_VERSION := 3
CUDA_DIR := /usr/local/cuda-8.0
BLAS := atlas
PYTHON_INCLUDE := /usr/include/python2.7 /usr/local/lib/python2.7/dist-packages/numpy/core/include
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
和Makefile为:
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
LIBRARIES += glog gflags protobuf leveldb snappy \
lmdb boost_system boost_filesystem hdf5_hl hdf5 m \
opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_videoio
我还尝试remove
并再次安装protobuf
库:
$ sudo apt-get purge libprotobuf-dev protobuf-compiler libprotoc10 -y
$ sudo apt-get autoremove
$ sudo apt-get install libprotobuf-dev protobuf-compiler libprotoc10 -y
$ sudo apt-get update
但问题仍然存在。