invalid mex file and missing libmwblas.dylib error
14 views (last 30 days)
Show older comments
I am compiling a MATLAB script on mac and i have downloaded Xcode for MEX file integration but I am getting the following error related to some missing libraries:
Invalid MEX-file '/Users/haneya/Desktop/SVT_MostRecent/private/XonOmega.mexmaci64':
dlopen(/Users/haneya/Desktop/SVT_MostRecent/private/XonOmega.mexmaci64, 6): Library not
loaded: @loader_path/libmwblas.dylib
Referenced from: /Users/haneya/Desktop/SVT_MostRecent/private/XonOmega.mexmaci64
Reason: image not found.
9 Comments
Samuel L. Polk
on 6 May 2021
@Walter Roberson Thank you for your quick response! Unfortunately, I'm having some trouble finding the folder '/user/lib/' in the package contents of the MATLAB software. Could you please describe where that folder is? I am runnning MATLAB R2021a on macOS Big Sur Version 11.2.3 if that is any help. Thank you again for your help.
Walter Roberson
on 7 May 2021
It was /usr/lib not /user/lib . And it is not inside the MATLAB software, it is a system folder that exists on systems derived from Unix.
!ls /usr/lib
However:
- in newer releases of MacOS, /usr/lib is controlled by System Integrity Protection, and it might be necessary to use csrutil to disable SIP to write to the directory
- starting from Big Sur, the root file system is "sealed", and you might need to unseal it, make the change to /usr/lib, and re-seal it afterwards; see https://eclecticlight.co/2020/06/25/big-surs-signed-system-volume-added-security-protection/
- I have seen a claim that you can write to /usr/local/lib instead of /usr/lib, and I see in the documentation for SIP that /usr/local is not protected. I do not know if this will work
- it looks like there may be approaches using install_name_change to modify MATLAB's idea of its library paths; https://briandfoy.github.io/macos-s-system-integrity-protection-sanitizes-your-environment/
- You might be able to modify rpath; see https://medium.com/@donblas/fun-with-rpath-otool-and-install-name-tool-e3e41ae86172
- However... although SIP is not supposed to affect MATLAB because it is not a "system executable" provided by Apple, in practice people observe that it does affect MATLAB because MATLAB is typically inside /Applications . And that implies that you might potentially need special steps to modify MATLAB's rpath .
Answers (1)
Omar Shadeed
on 24 Apr 2019
Hi Haneya,
I'm actually having the same error, I copied the libmwblas.dylib file from matlabroot and pasted it in my current matlab directory but I still get the same error.
Note: The mex is done successfully but when I run the Simulinknk model that uses the S-Function I get the same error you got. So what did you do to make it work?
Thanks,
The error I get is:
- Error while obtaining sizes from MEX S-function 'TrackerObject' in 'DSSDK_TrackerSingleObject/S-Function'.
- Caused by:
- Invalid MEX-file '/Users/omarshadeed/Desktop/VICON/Simulink models/DSSDK/SingleObject/TrackerObject.mexmaci64': dlopen(/Users/omarshadeed/Desktop/VICON/Simulink models/DSSDK/SingleObject/TrackerObject.mexmaci64, 6): Library not loaded: @executable_path/libViconDataStreamSDK_CPP.dylib Referenced from: /Users/omarshadeed/Desktop/VICON/Simulink models/DSSDK/SingleObject/TrackerObject.mexmaci64 Reason: image not found.
0 Comments
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!