フィルターのクリア

Invalid MEX-file on Macbook Pro, c++ code has been used on other computers

12 ビュー (過去 30 日間)
Ron Crump
Ron Crump 2024 年 4 月 5 日
編集済み: Pratyush Swain 2024 年 4 月 18 日
Hi.
I'm trying to compile a c++ function that I have used before (but I have run a system update since then).
It appears to compile, even though there is a deprecation warning:
>> mex Cbetabinornd.cpp
Building with 'Xcode Clang++'.
ld: warning: -undefined error is deprecated
ld: warning: -undefined error is deprecated
ld: warning: -undefined error is deprecated
ld: warning: -undefined error is deprecated
MEX completed successfully
.
But when I run the code that uses the function, I get:
Invalid MEX-file '/Users/lfslbx/nas/projects/transmission-code-dev/Cbetabinornd.mexmaci64':
dlopen(/Users/lfslbx/nas/projects/transmission-code-dev/Cbetabinornd.mexmaci64, 0x0006): Library not loaded:
@rpath/libMatlabEngine.dylib
Referenced from: <BD86438D-65C9-399D-8171-310DFAEC7570>
/Users/lfslbx/nas/projects/transmission-code-dev/Cbetabinornd.mexmaci64
Reason: tried: '/Applications/MATLAB_R2022b.app/bin/maci64/libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2022b.app/bin/maci64/./libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2022b.app/bin/maci64/../../sys/os/maci64/libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2022b.app/Contents/MacOS/libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2022b.app/Contents/MacOS/./libMatlabEngine.dylib' (no such file),
'/Applications/MATLAB_R2022b.app/Contents/MacOS/../../standalone/bin/maci64/libMatlabEngine.dylib' (no
such file), '/Applications/MATLAB_R2022b.app/Contents/MacOS/../../sys/os/maci64/libMatlabEngine.dylib' (no
such file), '/Applications/MATLAB_R2022b.app/bin/maci64/libMatlabEngine.dylib' (no such file)
Error in Projection (line 111)
ActiveS = Cbetabinornd(repmat(Data.PeopleScreened, samples, 1), repmat((Agg.ActiveMS' + Agg.ActiveM1' + Agg.ActiveM2' + Agg.ActiveMFP') ./ ScaledPeopleScreened0, samples, 1), repmat(Disp_act, samples, 1)); % M9
I'm running MATLAB R2022b on a Macbook Pro (M2 Pro chip) with MacOS 14.4.1 and Apple clang version 15.0.0 (clang-1500.3.9.4).
Any suggestions, please?
Thanks,
Ron Crump
  1 件のコメント
Ron Crump
Ron Crump 2024 年 4 月 5 日
If I compile and then run the code in R2023b (ie native silicon version), it compiles without the warning about deprecation and the code does not fail with the same error (I'm debugging something, so it does give an error, but now where I am debugging rather than with the MEX-file). Could it be that the mex in R2022b is compiling for arm64 architecture and it would need to be compiled for X86_64?

サインインしてコメントする。

採用された回答

Pratyush Swain
Pratyush Swain 2024 年 4 月 18 日
編集済み: Pratyush Swain 2024 年 4 月 18 日
Hi Ron,
This issue you are facing might be due to the fact MATLAB system requirements started supporting macOS Sonoma (14) from R2023b as per https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/system-requirements-release-2023b-macintosh.pdf
For checking system requirements in general for any release vs OS version support, you can refer to https://www.mathworks.com/support/requirements/previous-releases.html
Hope this helps.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWrite C Functions Callable from MATLAB (MEX Files) についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by