フィルターのクリア

Simulink issuing bad command when attempting to build mex file

4 ビュー (過去 30 日間)
Marshall
Marshall 2023 年 1 月 20 日
コメント済み: Shubham 2023 年 4 月 7 日
I'm upgrading a model from Simulink 2020b to 2022b and ran into a problem with a mex build failure. I've simplified the model and attached: example_mex_failure.slx.
If I run the command from the windows command prompt:
> "C:\Program Files\MATLAB\R2022b\bin\win64\mex.exe" -R2018a -silent LD="$MINGWROOT\bin\g++" LDFLAGS="$LDFLAGS ""C:\Program Files\MATLAB\R2022b\bin\win64\libmwdsp_halidesim.dll"" ""C:\Program Files\MATLAB\R2022b\bin\win64\libmwdsp_halidesim.dll""" -output example_mex_failure_sfun.mexw64 @example_mex_failure_sfun.mol
The build of the mex file completes successfully, but please note this differs from the command Matlab attempts:
> "C:\Program Files\MATLAB\R2022b\bin\win64\mex.exe" -R2018a -silent LD="$MINGWROOT\bin\g++" LDFLAGS="$LDFLAGS "C:\Program Files\MATLAB\R2022b\bin\win64\libmwdsp_halidesim.dll" "C:\Program Files\MATLAB\R2022b\bin\win64\libmwdsp_halidesim.dll"" -output example_mex_failure_sfun.mexw64 @example_mex_failure_sfun.mol
Matlab's command seems to omit escaping the nested quotation marks when building a mex file on "Normal" simulations.

採用された回答

Shubham
Shubham 2023 年 4 月 5 日
Hi Marshall,
Based on the information you have provided, it seems like the issue might be related to the way quotation marks are being handled by Matlab's mex command when building the mex file for "Normal" simulations. It appears that Matlab is not properly escaping the nested quotation marks in the command, leading to a build failure.
One possible workaround for this issue could be to use single quotes instead of double quotes to enclose the paths to the libraries in the mex command. For example, you could try the following command:
mex -R2018a -silent LD="$MINGWROOT\bin\g++" LDFLAGS="$LDFLAGS 'C:\Program Files\MATLAB\R2022b\bin\win64\libmwdsp_halidesim.dll' 'C:\Program Files\MATLAB\R2022b\bin\win64\libmwdsp_halidesim.dll'" -output example_mex_failure_sfun.mexw64 @example_mex_failure_sfun.mol
This command should properly enclose the library paths in single quotes, which should be interpreted correctly by the mex compiler. Note that I have also removed the duplicated path to the libmwdsp_halidesim.dll library in the command.
Another possible workaround could be to use the -argcheck option with the mex command to enforce strict argument checking, which might help identify any issues with how quotation marks are handled in the command. For example, you could try the following command:
mex -R2018a -silent -argcheck LD="$MINGWROOT\bin\g++" LDFLAGS="$LDFLAGS ""C:\Program Files\MATLAB\R2022b\bin\win64\libmwdsp_halidesim.dll"" ""C:\Program Files\MATLAB\R2022b\bin\win64\libmwdsp_halidesim.dll""" -output example_mex_failure_sfun.mexw64 @example_mex_failure_sfun.mol
This command should enable strict argument checking, which might help identify any issues with how quotation marks are handled in the command.
I hope these suggestions help resolve the issue you are facing with the mex build failure.
  2 件のコメント
Marshall
Marshall 2023 年 4 月 5 日
Thanks Shubham.
To elaborate on the workaround I'm using, edit a file at ...\R2022b\toolbox\stateflow\coder\private\code_interface_and_support_files.m to parse for the improper escape quotation mark condition and fix it (example attached).
I just figured this was an issue MathWorks would want to be aware of to fix in a future release.
Shubham
Shubham 2023 年 4 月 7 日
Thanks Marshall and this issue will surely be fixed in a future release.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by