hszhao / PSPNet

Pyramid Scene Parsing Network, CVPR2017.
https://hszhao.github.io/projects/pspnet
Other
1.58k stars 544 forks source link

Invalid MEX-file '/media/sgp1053c/DATA/PSPNET-cudnn5/matlab/+caffe/private/caffe_.mexa64 #87

Closed pewpewpeww closed 6 years ago

pewpewpeww commented 6 years ago

I had tried the LD_EXPORT method, but it still gives me the same error. Then, I chanced upon this difference when I tried different GCC version. Thus, may i know if this error is a result of my GCC??

ANY HELP WILL BE GREATLY APPRECIATED!!!!!! THANK YOU!!!

SYSTEM CONFIGURATIONS

System : Ubuntu 16.04 OpenCV : 2.4.9.1 Matlab : R2015a (as per compatible with caffe requirements) GCC : 5.5.0, 4.7.4 protobuf : 3.5.1 NVCC: 7.5, v7.5.17 CUDA : 8.0.61 CuDNN : 5.1.10

gcc (Ubuntu/Linaro 4.7.4-3ubuntu12) 4.7.4
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I try to run ./run_matlab in my evaluation folder, I got the error as follow:

Starting parallel pool (parpool) using the 'local' profile ... connected to 6 workers.
Error using caffe.reset_all (line 5)
Invalid MEX-file '/media/sgp1053c/DATA/PSPNET-cudnn5/matlab/+caffe/private/caffe_.mexa64':
/media/sgp1053c/DATA/PSPNET-cudnn5/matlab/+caffe/private/caffe_.mexa64: undefined symbol:
_ZN2cv8imencodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE

Error in eval_sub (line 23)
caffe.reset_all();

Error in eval_all (line 76)
parfor i = 1:gpu_num %change 'parfor' to 'for' if single GPU testing is used

When I make all and make matcaffe using GCC 5.5.0,

It showed that MEX completed successfully, with a warning that the gcc version is incorrect.

MEX matlab/+caffe/private/caffe_.cpp
Building with 'g++'.
Warning: You are using gcc version '5.5.0'. 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 '5.5.0-12ubuntu1~16.04)'. 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.
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0-rc3
CXX tools/caffe.cpp
MEX completed successfully.

Make was also successfully completed. [1]+ Done make all

However, if I run make matcaffe using GCC 4.7.4 and make all using GCC5.5.0, it will intern result in an error for make matcaffe

MEX matlab/+caffe/private/caffe_.cpp
Building with 'g++'.
/tmp/mex_315344958011358_19945/caffe_.o: In function `net_copy_from(int, mxArray_tag**, int, mxArray_tag const**)':
caffe_.cpp:(.text+0x1621): undefined reference to `caffe::Net<float>::CopyTrainedLayersFrom(std::string)'
/tmp/mex_315344958011358_19945/caffe_.o: In function `get_net(int, mxArray_tag**, int, mxArray_tag const**)':
caffe_.cpp:(.text+0x17c3): undefined reference to `caffe::Net<float>::Net(std::string const&, caffe::Phase, caffe::Net<float> const*)'
/tmp/mex_315344958011358_19945/caffe_.o: In function `get_solver(int, mxArray_tag**, int, mxArray_tag const**)':
caffe_.cpp:(.text+0x335e): undefined reference to `caffe::ReadSolverParamsFromTextFileOrDie(std::string const&, caffe::SolverParameter*)'
/tmp/mex_315344958011358_19945/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_315344958011358_19945/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:517: recipe for target 'matlab/+caffe/private/caffe_.mexa64' failed
make: *** [matlab/+caffe/private/caffe_.mexa64] Error 255