Invalid MEX-file: Library not loaded: #loader_path/libmex.dylib - matlab

macOS Mojave 10.14.5
While trying to run a MEX file in Matlab R2018b I got the following error:
Invalid MEX-file '/Users/...':
dlopen(/Users/...'): Library not loaded:
#loader_path/libmex.dylib
Reason: image not found.
I've already seen that this is problem related to the Mac's SIP but I can't find out how to solve it.
How can I solve this issue in matlab mac?

Related

Linux Mint 21.1 MATLAB 2022b VideoReader/initReader Could not read file due to an unexpected error. Reason: Unable to initialize the video properties

I have installed MATLAB 2022b on my LInux Mint 21.1. My laptop is an Acer Swift 3 with an Nvidia MX250 dedicated gpu. I have installed the drivers for the gpu, namely the nvidia-driver-525 and nvidia-utils-525 package.
The Nvidia X Server Settings seems to work and the Prime Profile is set to NVIDIA (Performance Mode).
The problem is when I am trying to load a video (.mp4 and .mov) in different frames, but when I ran the code I get this error in the console:
Main Error using VideoReader/initReader Could not read file due to an unexpected error. Reason: Unable to initialize the video properties
Error in audiovideo.internal.IVideoReader (line 136) initReader(obj, fileName, currentTime);
Error in VideoReader (line 104) obj#audiovideo.internal.IVideoReader(varargin{:});
Error in load_picture (line 2) vid = VideoReader(obj);
Error in Main (line 12) [vid, yval, t, nulv]=load_picture(obj);
When I was trying to run the code reading the video, I was getting this errors in the terminal session I opened MATLAB with:
(MATLAB:4591): GStreamer-WARNING **: 10:55:45.878: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstlibav.so': /home/malina/MATLAB/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /lib/x86_64-linux-gnu/librubberband.so.2)
(MATLAB:4591): GStreamer-Base-CRITICAL **: 10:55:45.909: basetransform: second attempt to fixate caps returned invalid (NULL) caps on pad vaapipostproc0:sink
I moved the libstdc++.so.6 from the MATLAB/sys/os folder to an unused folder, I have read that by doing this matlab will be forced to use the systems libstdc++.so.6 package, the version coming with the install being known to cause problems as stated by some forums. Doing that resulted in the same error from the console while running the code, but there is no more output from the terminal session.
The problem might be driver specific, but I am unsure. I have installed the codecs and libgstreamer1.0 packages, but I do not know how to test if they are the correct version for matlab. I can open the files on my system normally, so the codecs shouldn't be the problems.
Can anyone guide me through solving this issue? I'd be really grateful. Let me know if you want any other info that might be useful and if there are any log files created by matlab that could be useful in solving this issue, please let me know where I can find them.

How to fix dyld: Library not loaded: #rpath/libtbb.dylib

i'm using HiC-Pro mapping program on macOS Catalina. When it's running the log says:
dyld: Library not loaded: #rpath/libtbb.dylib
Referenced from: /Applications/anaconda3/bin/bowtie2-align-s
Reason: image not found
(ERR): Description of arguments failed!
Exiting now ...
Does anyone know how to fix this library not loaded error message?
I just started getting this error, as well -- environments I had installed just a couple weeks ago that included Bowtie2 still work, but when I install a new environment with the same Conda yaml file today it is no longer working, with this same error.
Try installing tbb through
brew install tbb
This fixed the error for me for a different binary that threw the same error.

installing libsvm on Mac (OSX 10.9.2)

I have tried to install the libsvm package with
mex -setup
(since "make" resulted in an error). This was followed by one choice for a compiler, so I chose "1".
Afterwards I typed in "make" got the following error though:
xcrun: error: SDK "macosx10.7" cannot be located
clang: warning: no such sysroot directory: '-mmacosx-version-min=10.7'
libsvmread.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
mex: compile of ' "libsvmread.c"' failed.
If make.m fails, please check README about detailed instructions.
What can I do?
I think the following answer from the matlab support might be helpful (http://www.mathworks.com/matlabcentral/answers/103904-can-i-use-xcode-5-as-my-c-or-c-compiler-in-matlab-8-1-r2013a-or-matlab-8-2-r2013b):
The Mac OS X 10.7 SDK, available in Xcode 4.1 through 4.6, is used by
MEX and related capabilities. This SDK is no longer available in Xcode
5, resulting in errors similar to the following when compiling:
xcodebuild: error: SDK "macosx10.7" cannot be located.
xcrun: error: unable to find utility "clang", not a developer tool or
in PATH
The simplest solution is to avoid updating Xcode to version 5 if you
are using R2013a or R2013b. If you need Xcode 5, or you have already
irreversibly upgraded to it, you can update MEX to use the 10.8 SDK:
In the MATLAB Command Window, execute the following commands:
cd(matlabroot)
cd bin
edit mexopts.sh
Save a backup copy of this file somewhere in case you make a mistake and you need to revert your changes.
Scroll down to the Mac (“maci64”) section of this file, beginning around line 120.
Replace all instances of 10.7 with 10.8; there are four of these in all (a fifth may be found in comments only)
Save the file, then execute the following command in the MATLAB Command Window:
mex -setup
Please note that this workaround links MEX files with a different SDK
than with which MATLAB was tested. Although there are no known
compatibility issues, support may be limited.

ld: cannot find -lguide while compiling files using mex with intel c++ compiler

Here is the situation:
Ubuntu 13.04, Matlab 2012a and Intel C++ Composer XE 2013 for Linux.
I downloaded a matlab code archive and followed the instructions in it to compile the .cpp files. Formerly when I finished installing Matlab 2012a and started it, some error messages showed up and I googled out an answer which is:
sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64/libc.so.6
And then there came out another error message which told me 'missing lstdc++' when I started compiling, the idea of re-installing g++ first came into my mind, and the error message disappeared after I did so. However, finally I got an error which I could not find an answer anywhere:
>> compilemex
ld: cannot find -lguide
mex: link of ' "max_pool.mexa64"' failed.
Error using mex (line 206)
Unable to complete successfully.
Error in compilemex (line 20)
eval(exec_string{1});
During the the process of searching for a solution, I found a thread for my previous 'missing lstdc++' error which differed from what I did to fix it, does this matter or not? And another hint is that I could not find any file named like 'libguide' under the /opt/intel/ directory, how could I fix it?
Thanks in advance!
Googl'ing for libguide, i found this:
http://software.intel.com/en-us/forums/topic/284445
According to this, the build script you're using refers to an old version of the intel compiler. Newer versions seem to have the functions in libguide.so moved to libiomp5.so.
So try replacing -lguide by -liomp5.
Disclaimer: this is pure google knowledge. Personally I have no idea what either library is good for :)

Matlab: loading wmv video files

I am trying to load a wmv video in Matlab as follows:
vidObj = mmreader('video.wmv');
However, I receive the following error:
The file requires the following codec(s) to be installed on your system: video/x-ms-asf
I don't understand why I am receiving this error, since I am able to play wmv files on my system. I am running Matlab 7.10.0 (R2010a) on Ubuntu 11.04. How can I fix this problem?
it might be hard to impossible to get this working on a linux system. Alternatively, you could write your own wmv import function (if you know how to talk to the underlying libraries on your linux system, i.e. vlc).
I have received the same error message because of a version conflict for the standard c++ library.
I have started MATLAB in a console window and recognized that Gstreamer fails to load a plug-in.
(:26573): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstffmpeg.so':
/usr/local/MATLAB/2010b/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libdirac_encoder.so.0)
The problem is, MATLAB ships with libstdc++.so.6.0.10 and GStreamer complains that it should work with libstdc++.so.6.0.13
So you should replace the symbolic link in MATLAB dir with the one in your system.
$ rm /usr/local/MATLAB/2010b/sys/os/glnx86/libstdc++.so.6
$ ln -s /usr/lib/libstdc++.so.6 /usr/local/MATLAB/2010b/sys/os/glnx86/libstdc++.so.6