Open changh95 opened 5 years ago
Do you have the Computer Vision System Toolbox?
>> ver vision
>> ls /usr/local/MATLAB/R2018b/bin/glnxa64/libopencv*
The output from getBuildInformation
indicates that the wrong opencv is being loaded at runtime (v3.4.0 libs that ship with CVST toolbox, not the v3.4.1 libs you would have built from source if you followed the wiki installation guide).
To see the conflicting libraries, run ldd
both inside MATLAB and outside in a terminal:
% MATLAB
>> !ldd /home/changh95/cv/mexopencv/+cv/imread.mexa64
# Terminal
$ ldd /home/changh95/cv/mexopencv/+cv/imread.mexa64
You'll need to preload the libs as needed, as explained in the troubleshooting section:
$ LD_PRELOAD=/usr/local/lib/libopencv_core.so.3.4:[...etc...] matlab
As alternative, you could simply avoid the conflict with CVST libs by moving/renaming them temporarily before starting matlab to run mexopencv.
A third way, which I haven't tested myself, is to use RPATH when building the mex-files, that way the mex-files are hardcoded to look for the locally-installed opencv libs first. You would build mexopencv as following:
$ LDFLAGS=-Wl,-rpath,/usr/local/lib make all contrib
FYI here's a similar previous discussion: https://github.com/kyamagu/mexopencv/issues/352#issuecomment-321618725
Hi all,
I am experiencing invalid MEX-file issue, which I think it may be a little different from the errors that other people are experiencing, so I'm raising an issue.
To explain what I've done so far:
I've just followed the Linux installation guide to install mexopencv on MATLAB 2018b on Ubuntu 16.04LTS.
I noticed that there was the GCC version mismatch during the build, but the mex-ing operation seemed to go successfully.
After setting the path, I tried the two commands shown at the installation guide, which are:
This is what the
cv.getBuildInformation()
shows:And this is what I get after the
UnitTest('ContriModules',true)
As you see, there seems to be a library clash between the essential libraries for mexopencv and the libraries under anaconda3 (which I installed for pytorch purpose).
If any of you guys know how to resolve this library issues, please share your solutions and I'll greatly appreciate your support :)