Effacer les filtres
Effacer les filtres

Matlab coder unable to compile MEX function with MinGW64 Compiler

9 vues (au cours des 30 derniers jours)
Marco Montanaro
Marco Montanaro le 1 Juil 2022
Hello, I am trying to compile a Mex function for a model I've created, but for some reason despite updating, configuring and managing the MinGW compiler for Matlab, I cannot seem to get it working properly anymore.
I start up Matlab Codegen, run through the requested steps, but Matlab keeps failing at the "Check for Run-Time Issues" part when it has to generate a Mex. More specifically this is the error I get:
[291/291] C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\mingw_w64.instrset\bin\gcc @SDM_main_mex.mexw64.rsp -m64 -Wl,--no-undefined -shared -static -L"C:\Program Files\MATLAB\R2020b\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas -o "SDM_main_mex.mexw64" -llibemlrt -llibcovrt -llibut -llibmwmathutil "C:/Users/marco/Dropbox/RFI - SDM Marco/SDM/Modelli\BaseSw.lib" "ws2_32.lib" "C:/Users/marco/Dropbox/RFI - SDM Marco/SDM/Modelli\CFM.lib" "C:/Users/marco/Dropbox/RFI - SDM Marco/SDM/Modelli\SFM.lib" -Wl,--version-script,SDM_main_mex.map
FAILED: SDM_main_mex.mexw64 
C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\mingw_w64.instrset\bin\gcc @SDM_main_mex.mexw64.rsp -m64 -Wl,--no-undefined -shared -static -L"C:\Program Files\MATLAB\R2020b\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas -o "SDM_main_mex.mexw64" -llibemlrt -llibcovrt -llibut -llibmwmathutil "C:/Users/marco/Dropbox/RFI - SDM Marco/SDM/Modelli\BaseSw.lib" "ws2_32.lib" "C:/Users/marco/Dropbox/RFI - SDM Marco/SDM/Modelli\CFM.lib" "C:/Users/marco/Dropbox/RFI - SDM Marco/SDM/Modelli\SFM.lib" -Wl,--version-script,SDM_main_mex.map
gcc: error: ws2_32.lib: No such file or directory
ninja: build stopped: subcommand failed.
I have tried running it on both R2020b and R2021b, I've followed the steps present in https://www.mathworks.com/matlabcentral/answers/313298-i-already-have-mingw-on-my-computer-how-do-i-configure-it-to-work-with-matlab as well to no avail. I don't really get why it suddenly refuses to cooperate anymore, as I was previously able to generate Mex functions no problem.
  4 commentaires
Walter Roberson
Walter Roberson le 1 Juil 2022
You need VS2019 instead of VS2022
Marco Montanaro
Marco Montanaro le 1 Juil 2022
Modifié(e) : Marco Montanaro le 1 Juil 2022
Worked like a cinch! I should also add to this though that the issue seems to be something that also relates to Matlab R2021b. Running Codegen with Matlab R2020b + VisualStudio 2019 fixed it! Thanks!

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by