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

就是增加一个编译选项。

 

你可能感兴趣的:(Linux)