mbuild setup fails / crashes, while mex setup works / succeeds / passes in 2017a windows 7

2 次查看(过去 30 天)
Howdy, Trying to make an s-function outside of matlab, and the mingw make utility is citing "undefined reference : mxGetPr" in simulink files as an example. So I'm trying to make sure i have all the includes and libs, and options setup for the make to work. After a few hours of research the mbuild script was brought to my attention. Looking at its xml for make file options, it looks like what i need. But long story short i was attempting to use mbuild but the -setup switch keeps failing. Even though a supported compiler is found... by mex!
>> mbuild -setup Error using mbuild (line 164) Unable to complete successfully. No supported compiler or SDK was found. You can install the freely available MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler. For more options, visit http://www.mathworks.com/support/compilers/R2017a/.
>> getenv('MINGWROOT')
ans =
'C:\MinGW\'
>> mex -setup MEX configured to use 'MinGW64 Compiler (C)' for C language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. You will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different language, select one from the following: mex -setup C++ mex -setup FORTRAN
MEX configured to use 'MinGW64 Compiler (C++)' for C++ language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. You will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
>> getenv('MW_MINGW64_LOC')
ans =
'C:\MinGW\'

采纳的回答

Ankitha Kollegal Arjun
The error message 'You can install the freely available MinGW-w64 C/C++ compiler...' is misleading. As of R2015b, the free compiler supported for deployment is Windows SDK 7.1. MinGW is supported only with MEX. Please install the Windows SDK 7.1 if you would like to use mbuild.
  2 个评论
adam honse
adam honse 2017-11-8
So, the Windows SDK and its required framework, wouldn't install. I didn't want to re-install my OS to try and make that work (Which prolly wouldn't have happened on this work computer. ) Long story short, i updated to 17b, and downloaded the the mingw version that comes with it via the 3rd party tools, and a few small fixes later everything worked using mex. I did attempt to use a regular makefile outside of the matlab realm with the version of mingw provided, and it to failed miserably. (I even used the same calls that mex did, and it gave some weird linking errors. ) So i plan on just using mex or having an actual software engineer do it with make. :)
Adam
Harsheel
Harsheel 2017-11-15
just to clarify, you CAN use the MinGW 5.3.0 compiler in R2017b with "both" MEX and MBUILD. From R2015b to R2017a, MBUILD did not support MinGW compiler though. Also, Windows SDK 7.1 is unsupported as of R2017b. The latest compilers that are supported with MathWorks products can be found here .

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by