2016-10-31 25 views
1

私はMatcaffeをUbuntu 16.04でコンパイルしようとしています。私は正常にcaffeとpycaffeをコンパイルすることができました(gcc 5を使用)。しかし、Ubuntuの16.04は、GCC 5が付属しており、MATLAB R2016bはGCC 4.9と互換性があり、私は(メイクmatcafeeを使用して)コンパイル時に警告を次得たので:Matcaffe on Ubuntu 16.04

MEX matlab/+caffe/private/caffe_.cpp Building with 'g++'. Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is '4.9.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release . MEX completed successfully.

MEXファイルが作成されていても、私はできませんそれらを認識しないので、MATLABから使用してください。

この問題を解決するために、gcc 4.9およびg ++ 4.9をインストールし、それらを使用するシンボリックリンクを更新しました。私はmatcaffeをコンパイルしようとすると、私は次のようなエラーメッセージが表示されます:

MEX matlab/+caffe/private/caffe_.cpp Building with 'g++'. /tmp/mex_286607035953408_13265/caffe_.o: In function net_copy_from(int, mxArray_tag**, int, mxArray_tag const**)': caffe_.cpp:(.text+0x167d): undefined reference to caffe::Net::CopyTrainedLayersFrom(std::string)' /tmp/mex_286607035953408_13265/caffe_.o: In function get_net(int, mxArray_tag**, int, mxArray_tag const**)': caffe_.cpp:(.text+0x182b): undefined reference to caffe::Net::Net(std::string const&, caffe::Phase, int, std::vector > const*, caffe::Net const*)' /tmp/mex_286607035953408_13265/caffe_.o: In function get_solver(int, mxArray_tag**, int, mxArray_tag const**)': caffe_.cpp:(.text+0x343f): undefined reference to caffe::ReadSolverParamsFromTextFileOrDie(std::string const&, caffe::SolverParameter*)' /tmp/mex_286607035953408_13265/caffe_.o: In function std::string* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)': caffe_.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKc]+0x42): undefined reference to google::base::CheckOpMessageBuilder::NewString()' /tmp/mex_286607035953408_13265/caffe_.o: In function std::string* google::MakeCheckOpString<unsigned long, int>(unsigned long const&, int const&, char const*)': caffe_.cpp:(.text._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc]+0x42): undefined reference to google::base::CheckOpMessageBuilder::NewString()' collect2: error: ld returned 1 exit status

Makefile:511: recipe for target 'matlab/+caffe/private/caffe_.mexa64' failed make: *** [matlab/+caffe/private/caffe_.mexa64] Error 255

は、誰もが成功したのUbuntu 16.04にMatcaffeをコンパイルしていますか? 私はMATLAB R2014bとgcc 4.7で同じ手順を試みましたが、成功しませんでした。

答えて

1

CaffeはlibstdC++とopencvのシステムバージョンに対してコンパイルされていますが、matcaffeを実行しているときはmatlabバージョンにリンクしています。私はOpenCVの(Makefile.configUSE_OPENCV := 0コメントを解除)カフェの構築~/.bashrc

export LD_PRELOAD=${LD_PRELOAD}:/usr/local/x86_64-linux-gnu/libstdc++.so.6 

を付加し、無効にすることによって好都合に、これを解決しました。

+0

問題なく動作します。 – user1586259