Closed DCurro closed 7 years ago
Yes, this is exactly the reason of the error. Matlab is now distributing its own OpenCV and Protobuf and causing conflicts.
Is there any good resolution to this? How can I ignore the matlab versions, and use the one's from the tutorial?
It is quite tricky, as the mex
compiling tool always appends the Matlab's internal library path before LIBRARY_DIRS. I tried to temporarily removed these matlab libraries during compiling, and use DYLD_INSERT_LIBRARIES
at runtime.
Could you produce a step by step tutorial? This sounds a little intense for someone like myself.
Having exactly the same problem, Haven't been able to resolve it, even after uninstalling Matlab completely I still get the same error.
I will try again over the christmas break. If I find a solution I will post it here. Hopefully someone beats me to it.
A hacky solution that worked for me was to temporarily remove matlab's version of libprotobuf, compile, then restore matlab's version (the same might work for the opencv libs):
mv /Applications/MATLAB_R2015a.app/bin/maci64/libprotobuf.dylib /Applications/MATLAB_R2015a.app/bin/maci64/libprotobuf.dylib_bk
mv /Applications/MATLAB_R2015a.app/bin/maci64/libprotobuf.8.dylib /Applications/MATLAB_R2015a.app/bin/maci64/libprotobuf.8.dylib_bk
make matcaffe
mv /Applications/MATLAB_R2015a.app/bin/maci64/libprotobuf.dylib_bk /Applications/MATLAB_R2015a.app/bin/maci64/libprotobuf.dylib
mv /Applications/MATLAB_R2015a.app/bin/maci64/libprotobuf.8.dylib_bk /Applications/MATLAB_R2015a.app/bin/maci64/libprotobuf.8.dylib
I had a similar error on a linux system. In that case, matcaffe did compile, but at runtime still linked against matlab's incompatible libprotobuf. The following invocation of matlab fixed this:
LD_PRELOAD=/usr/local/lib/libprotobuf.so.10 matlab
where the path specifies a compatible version of protobuf.
Thanks @phillipi that solved my compilation problem. For reference to others, I am trying to compile on El Capitan for Matlab 2016a. I needed to rename cudnn library as well, so mine looked like
mv /Applications/MATLAB_R2016a.app/bin/maci64/libprotobuf.dylib /Applications/MATLAB_R2016a.app/bin/maci64/libprotobuf.dylib_bk
mv /Applications/MATLAB_R2016a.app/bin/maci64/libprotobuf.8.dylib /Applications/MATLAB_R2016a.app/bin/maci64/libprotobuf.8.dylib_bk
mv /Applications/MATLAB_R2016a.app/bin/maci64/libcudnn.dylib /Applications/MATLAB_R2016a.app/bin/maci64/libcudnn.dylib_bk
mv /Applications/MATLAB_R2016a.app/bin/maci64/libcudnn.7.0.dylib /Applications/MATLAB_R2016a.app/bin/maci64/libcudnn.7.0.dylib_bk
make matcaffe
mv /Applications/MATLAB_R2016a.app/bin/maci64/libprotobuf.dylib_bk /Applications/MATLAB_R2016a.app/bin/maci64/libprotobuf.dylib
mv /Applications/MATLAB_R2016a.app/bin/maci64/libprotobuf.8.dylib_bk /Applications/MATLAB_R2016a.app/bin/maci64/libprotobuf.8.dylib
mv /Applications/MATLAB_R2016a.app/bin/maci64/libcudnn.dylib_bk /Applications/MATLAB_R2016a.app/bin/maci64/libcudnn.dylib
mv /Applications/MATLAB_R2016a.app/bin/maci64/libcudnn.7.0.dylib_bk /Applications/MATLAB_R2016a.app/bin/maci64/libcudnn.7.0.dylib
Closing as duplicate of #3005
I can compile caffe normally.
When I add this to the LIBRARY_DIRS, I get the error seen at the bottom:
If I try to make matcaffe, it also doesn't build.
I read somewhere that Matlab now distributes their own protobuf and opencv, and that this is likely the conflict.
error: