1. 程式人生 > >Ubuntu中編譯caffe依賴的庫

Ubuntu中編譯caffe依賴的庫

如果出現編譯caffe時,也就是(make時)出現以下情況:

1.

LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/ld: /home/yang/local_install/lib/libgflags.a(gflags.cc.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:582: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1

2.

make
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/ld: /usr/local/lib/libsnappy.a(snappy.cc.o): relocation R_X86_64_PC32 against symbol `_ZN6snappy4Bits19FindLSBSetNonZero64Em' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:582: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1

這時,找到錯誤輸出中提示的庫,即libgflags.a   這些檔案,然後將其刪除。

 第二步:

在這些安裝包所在的原始碼中mkdir build。cd build。然後在終端輸入:

export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1

 第三步:

make

make install

就是增加一個編譯選項。