目前,我正在嘗試安裝毫升包到 Ubuntu 12.04。當我執行時make install
,出現以下錯誤。
[ 0%] Built target mlpack_headers
Linking CXX shared library ../../lib/libmlpack.so
/usr/bin/ld: /usr/local/lib/libboost_program_options.a(cmdline.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libboost_program_options.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/libmlpack.so.1.0] Error 1
make[1]: *** [src/mlpack/CMakeFiles/mlpack.dir/all] Error 2
make: *** [all] Error 2
如何修復此錯誤並成功安裝 mlpack?
答案1
我有同樣的問題。我使用重新安裝了每個依賴項
sudo apt-get install libboost-math-dev libboost-program-options-dev libboost-random-dev
libboost-test-dev libxml2-dev liblapack-dev libblas-dev libarmadillo-dev
在mlpack資料夾內:執行下列指令
mkdir build
cd build
cmake ../
makes
sudo make install
之後運行可執行檔使用此設定路徑關聯.....為我工作。
答案2
使用 -fPIC 重新編譯你的 boost,例如 ./bjamcxxflags=-fPIC--without-python --without-graph_parallel --without-graph --without-wave 安裝