MatCaffe (Caffe の Matlab ラッパー) のビルド中に、次のエラーに直面します。
[ 96%] Built target convert_mnist_data
[ 96%] Built target convert_mnist_siamese_data
[ 98%] Built target pycaffe
[100%] Building Matlab interface: /home/trunks/Downloads/caffe-master/matlab/+caffe/private/caffe_.mexa64
Building with 'g++'.
Warning: You are using gcc version '4.8.2'. The version of gcc is not supported. The version currently supported with MEX is '4.7.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release.
Warning: You are using gcc version '4.8.2-19ubuntu1)'. The version of gcc is not supported. The version currently supported with MEX is '4.7.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release.
/usr/bin/ld: cannot find -lpython2
collect2: error: ld returned 1 exit status
make[2]: *** [../matlab/+caffe/private/caffe_.mexa64] Error 255
make[1]: *** [matlab/CMakeFiles/matlab.dir/all] Error 2
make: *** [all] Error 2
詳しく調べたところ、次のコマンドを使用して、次のファイルが上記のエラーの原因であることがわかりました。
grep -rnw "./" -e "-lpython2"
それは私に次のことを明らかにしました:
./matlab/CMakeFiles/matlab.dir/build.make:53: cd /home/trunks/Downloads/caffe-master/build/matlab && /usr/local/MATLAB/R2014a/bin/mex -output /home/trunks/Downloads/caffe-master/matlab/+caffe/private/caffe_.mexa64 /home/trunks/Downloads/caffe-master/matlab/+caffe/private/caffe_.cpp -DCPU_ONLY -DWITH_PYTHON_LAYER -DGTEST_USE_OWN_TR1_TUPLE -I/home/trunks/Downloads/caffe-master/src -I/usr/include -I/home/trunks/Downloads/caffe-master/build/external/glog-install/include -I/home/trunks/Downloads/caffe-master/build/external/gflags-install/include -I/home/trunks/Downloads/caffe-master/build/include -I/usr/local/include/opencv -I/usr/local/include -I/usr/include/python2.7 -I/home/trunks/anaconda/lib/python2.7/site-packages/numpy/core/include -I/home/trunks/Downloads/caffe-master/include -I/home/trunks/Downloads/caffe-master/build -L/home/trunks/Downloads/caffe-master/build/lib -L/usr/lib/x86_64-linux-gnu -L/home/trunks/Downloads/caffe-master/build/external/gflags-install/lib -L/home/trunks/Downloads/caffe-master/build/external/glog-install/lib -L/usr/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lcaffe -lboost_system -lboost_thread -lpthread -lgflags -lglog -lhdf5_hl -lhdf5 -llmdb -lleveldb -lsnappy -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -lopenblas -lpython2 -lboost_python -lprotobuf
そのため、問題を解決することを期待して、対応する -lpython2 を -lpython2.7 に変更しました。しかし、収穫はありません。
私も次のことを試しました:
- CMakeCache.txt を削除し、make を実行します。しかし、うまくいきませんでした。
/cmake-master にあるデフォルトの CMakeLists.txt ファイルを編集して、いくつかのデフォルト設定を変更しました。Caffe の CMakeLists.txt のデフォルトの python バージョン設定は 2 であることがわかりました。
//使用する python バージョンを指定 python_version:STRING=2.7
これを 2 に変更し、新しいビルド フォルダーで configure-generate-make プロセス全体を繰り返しました。しかし、収穫はありません。同じ matlab/build.make ファイルに -lpython2 が表示されるたびに、それを 2.7 に直接変更しても生成されません。
- matlab/build.make ファイルを調べようとしましたが、このエラーに直接接続できるものは見つかりませんでした。
堅実な助けをいただければ幸いです。Ubuntu 14.04 で MATLAB 2014a を使用しています。