caffe 編譯,安裝 報錯解決方法

2021-10-08 02:22:21 字數 3823 閱讀 6000

sudo apt install caffe-cuda --fix-missing

make -j8 && make pycaffe

sudo apt  install protobuf-compiler

sudo apt-get install libgoogle-glog-dev

1.caffe/blob.hpp:9:34: fatal error: caffe/proto/caffe.pb.h: 沒有那個檔案或目錄

protoc src/caffe/proto/caffe.proto --cpp_out=.

mkdir include/caffe/proto

mv src/caffe/proto/caffe.pb.h include/caffe/proto

2..build_release/src/caffe/proto/caffe.pb.h:9:10: fatal error: google/protobuf/stubs/common.h: no such file or directory

protoc --version

libprotoc 3.0.0

caffe需要protoc版本為2,protobuf 2.6.1安裝、配置、解除安裝

sudo ln -s usr/local/bin/protoc /usr/bin/protoc

3.src/caffe/data_transformer.cpp:2:10: fatal error: opencv2/core/core.hpp: no such file or directory

opencv安裝

修改makefile.config中

#include_dirs := $(python_include) /usr/local/include

#library_dirs := $(python_lib) /usr/local/lib /usr/lib

為include_dirs := $(python_include) /usr/local/include /usr/include/hdf5/serial /opt/opencv2/include

library_dirs := $(python_lib) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /opt/opencv2/lib

4.src/caffe/layers/hdf5_data_layer.cpp:13:10: fatal error: hdf5.h: no such file or directory

apt-get install libhdf5-serial-dev

5../include/caffe/util/db_leveldb.hpp:7:10: fatal error: leveldb/db.h: no such file or directory

git clone

6../include/caffe/util/db_lmdb.hpp:8:10: fatal error: lmdb.h: no such file or directory

apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

7.nvcc fatal   : unsupported gpu architecture 'compute_20'

makefile:594: recipe for target '.build_release/cuda/src/caffe/layers/absval_layer.o' failed

在makefile.config檔案中根據自己cuda的版本注釋不同的行。

# cuda architecture setting: going with all of them.

# for cuda < 6.0, comment the *_50 through *_61 lines for compatibility.

# for cuda < 8.0, comment the *_60 and *_61 lines for compatibility.

# for cuda >= 9.0, comment the *_20 and *_21 lines for compatibility.

cuda_arch := #-gencode arch=compute_20,code=sm_20 \

#-gencode arch=compute_20,code=sm_21

-gencode arch=compute_30,code=sm_30 \

-gencode arch=compute_35,code=sm_35 \

-gencode arch=compute_50,code=sm_50 \

-gencode arch=compute_52,code=sm_52 \

-gencode arch=compute_60,code=sm_60 \

-gencode arch=compute_61,code=sm_61 \

-gencode arch=compute_61,code=compute_61

sudo apt-get install libatlas-base-dev

9..build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_inputarray const&, int)'

collect2: error: ld returned 1 exit status

collect2: error: ld returned 1 exit status

在makefile.config檔案中取消注釋   opencv_version := 3

10.python/caffe/_caffe.cpp:10:10: fatal error: numpy/arrayobject.h: no such file or directory

sudo apt-get install python-numpy

11./usr/bin/ld: cannot find -lpython3.6

將 /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/(libpython3.6.so所在資料夾)新增到makefile.config檔案中

library_dirs := $(python_lib) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /opt/opencv2/lib /usr/lib/x86_64-linux-gnu /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/(libpython3.6.so所在資料夾)

12./usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `pystring_fromformat'

/usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `pyunicodeucs4_fromencodedobject'

/usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `pynumber_inplacedivide'

cd /usr/lib/x86_64-linux-gnu/

sudo rm libboost_python.so

sudo ln -s libboost_python-py36.so libboost_python.so

JSONKit編譯報錯解決方法

如果從github上下來的jsonkit在使用的時候報編譯錯誤,可以按如下的方式嘗試解決 1 build phases compile sources,雙擊jsonkit.m,輸入 fno objc arc 2 修改jsonkit.m檔案第680行,修改為object setclass array,...

編譯 libiconv 報錯解決方法

第乙個方法 切換到libiconv srclib目錄下 cd srclib 修改stdio.in.件 vim stdio.in.h 通過搜尋,定位到 gl warn on use gets,gets is a security hole use fgets instead 這一行,然後在這一行的前後...

php編譯安裝報錯記錄及解決方法

報錯 configure error cannot find libpq fe.h.please specify correct postgresql installation path 解決方法 yum y install postgresql devel報錯 configure error xs...