Invalid MEX-file macOS

16 views (last 30 days)
Tine Skui
Tine Skui on 17 Oct 2023
Answered: Jinal on 23 Oct 2023
I have been trying to run ValoMC (https://github.com/InverseLight/ValoMC/archive/master.zip) for Monte Carlo simulations in MATLAB, but can't run it. I have followed the installation guide and am using Xcode as compiler, but when trying to run the example files I get the error:
How can I fix this?
Note: I've tried entering otool -L libMatlabEngine.dylib in the terminal but then this comes up: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic: can't open file: libMatlabEngine.dylib (No such file or directory)"

Answers (1)

Jinal
Jinal on 23 Oct 2023
Hello Tine,
As per my understanding, you are encountering errors while executing C++ MEX files on your macOS.
You can try the following workaround to resolve the issue you are facing:
Set the "DYLD_LIBRARY_PATH" environment variable to the path specified below:
‘matlabroot/extern/bin/maci64’
For more information on Run-Time Environment requirements for building C++ Engine programs, please refer the following link: https://www.mathworks.com/help/matlab/matlab_external/build-c-engine-programs.html#mw_4ec5bd7e-1127-41a8-844c-817cb7a9cae3
I hope that this helps resolve the issue you are facing.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!