Invalid Mex file for Caffe MATLAB wrapper

1,253 views
Skip to first unread message

Awais Ashfaq

unread,
Feb 23, 2016, 3:15:02 AM2/23/16
to Caffe Users
I recently installed caffe and everything went well.
But when I try to call abasic caffe call it gives the following error:
weights = './models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel';
model = './models/bvlc_reference_caffenet/deploy.prototxt';
net = caffe.Net('deploy.prototxt', weights, 'test'); % create net and load weights
Output:
Invalid MEX-file '/home/awais/caffe/matlab/+caffe/private/caffe_.mexa64': libcaffe.so.1.0.0-rc3: cannot open shared
object file: No such file or directory

Please guide what am I missing here!

Jan C Peters

unread,
Feb 23, 2016, 3:40:22 AM2/23/16
to Caffe Users
The loader does not find the compiled caffe library. This is a very common linux "problem". There are several approaches to this, the easiest is giving its directory in LD_LIBRARY_PATH env variable (when starting matlab in this case).

Jan

Ignacio Arganda-Carreras

unread,
Feb 26, 2016, 9:32:48 AM2/26/16
to Caffe Users
Hello Jan,

I have the same problem on Ubuntu  14.04 even after setting the LD_LIBRARY_PATH to my caffe root directory. I tried including as well the caffe/build, caffee/matlab and caffe/build/lib folders. Nothing works for me. What am I missing?

Thanks a lot in advance!

ans...@silklabs.com

unread,
Feb 26, 2016, 9:35:56 PM2/26/16
to Caffe Users
Were you able to find the solution to your problem?

Jan C Peters

unread,
Feb 29, 2016, 3:10:36 AM2/29/16
to Caffe Users
Did you start Matlab form the shell where you have set LD_LIBRARY_PATH? Also, do not set it to the caffe root directory, but to the directory that contains the compiled libcaffe.so. Check in Matlab with getenv('LD_LIBRARY_PATH') if the env variable is correctly recognized.

Jan

Ignacio Arganda-Carreras

unread,
Feb 29, 2016, 4:23:59 AM2/29/16
to Caffe Users
Hello Jan,

Pointing LD_LIBRARY_PATH to the folder where libcaffe.so is made it work.

Thank you very much!

ignacio
Reply all
Reply to author
Forward
0 new messages