Library not loaded: @rpath/lib​MatlabEngi​ne.dylib

My operating system is macOS Sonoma 14.3.1.
I am using Matlab 2019_b.
When I try to run the following code:
cd(matlabroot)
cd extern/examples/cpp_mex
mex arrayProduct.cpp
result = arrayProduct(3, 3)
I get the following error:
Invalid MEX-file '/Applications/MATLAB_R2019b.app/extern/examples/cpp_mex/arrayProduct.mexmaci64':
dlopen(/Applications/MATLAB_R2019b.app/extern/examples/cpp_mex/arrayProduct.mexmaci64, 0x0006): Library not loaded: @rpath/libMatlabEngine.dylib
Referenced from: <29FCC841-A662-36AB-A272-E674D72B9955> /Applications/MATLAB_R2019b.app/extern/examples/cpp_mex/arrayProduct.mexmaci64
Reason: tried: '/Applications/MATLAB_R2019b.app/bin/maci64/libMatlabEngine.dylib' (no such file), '/Applications/MATLAB_R2019b.app/bin/maci64/./libMatlabEngine.dylib' (no
such file), '/Applications/MATLAB_R2019b.app/bin/maci64/../../sys/os/maci64/libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2019b.app/bin/maci64/libMatlabEngine.dylib' (no such file), '/Applications/MATLAB_R2019b.app/bin/maci64/./libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2019b.app/bin/maci64/../../sys/os/maci64/libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2019b.app/bin/maci64/../../runtime/maci64/libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2019b.app/bin/maci64/../../sys/java/jre/maci64/jre/lib/server/libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2019b.app/bin/maci64/../../sys/java/jre/maci64/jre/lib/libMatlabEngine.dylib' (no such file)
I followed the steps in the following bug:
https://www.mathworks.com/support/bugreports/details/3138142
I replaced the file clang++_maci64.xml with the one provided in the archive in the bug. However I am still seeing the above error.

Antworten (1)

Ji Ye
Ji Ye am 6 Apr. 2024

0 Stimmen

Hi Joseph,
I hope this message finds you well! I recall you mentioned encountering an issue similar to one I recently faced. I wanted to share the solution that worked for me, just in case you're still looking for a fix:
  1. Replace the file clang++_maci64.xml with the one provided in the archive in the bug.
  2. Reconfigure MATLAB's Mex Compiler:
  • Open your MATLAB command window and run mex -setup.
  • choose the C++ setup option and point it to the updated clang++_maci64.xml file.
This simple fix got me back on track, and I'm hoping it does the same for you. Happy coding, and do let me know if it helps or if you've found another workaround in the meantime!
Best regards,
Ye

Kategorien

Mehr zu MATLAB Compiler finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2019b

Gefragt:

am 15 Mär. 2024

Beantwortet:

am 6 Apr. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by