MinGw64 compiler bugged in 2018a ?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I try to build a mex of a file who used lib c:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\lib\libiphlpapi.a
When i use the mex command it looks for .lib files. But all the libraries are .a in the folder which i specified with -L . How to make linker to look for .a files ?
Here is the command:
mex -v -L"c:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\lib" -llibiphlpapi.a MACAddress_mex.c
Verbose mode is on.
... Looking for compiler 'MinGW64 Compiler (C)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset').
... Looking for file 'C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\bin\gcc.exe' ...Yes.
... Looking for folder 'C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset' ...Yes.
Found installed compiler 'MinGW64 Compiler (C)'.
Set PATH = C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\bin;C:\MATLAB\R2018a\extern\include\win64;C:\MATLAB\R2018a\extern\include;C:\MATLAB\R2018a\simulink\include;C:\MATLAB\R2018a\lib\win64;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\TDM-GCC-64\bin;C:\MATLAB\R2018a\bin;C:\Users\timo\AppData\Local\Microsoft\WindowsApps;c:\SysGCC\mingw64\bin;
Set INCLUDE = C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\include;;C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\include;;
Set LIB = C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\lib;;C:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\lib;;
Set MW_TARGET_ARCH = win64;win64;
Set LIBPATH = C:\MATLAB\R2018a\extern\lib\win64;C:\MATLAB\R2018a\extern\lib\win64;
Error using mex
MEX cannot find library 'libiphlpapi.a' specified with the -l option.
MEX looks for a file with one of the names:
liblibiphlpapi.a.lib
libiphlpapi.a.lib
Please specify the path to this library with the -L option.
Ps: it worked if i renamed the libiphlpapi.a to libiphlpapi.lib , but seems like a hack and not a proper solution . I think MSVC and MinGW operate differently w.r.t. expected extensions. While MSVC normally creates static libraries with a .lib extension, MinGW/MSYS respects the Unix defaults and requires a .a
3 commentaires
Walter Roberson
le 28 Mar 2018
Try
mex -v -L"c:\ProgramData\MATLAB\SupportPackages\R2018a_1\3P.instrset\mingw_w64.instrset\x86_64-w64-mingw32\lib" MACAddress_mex.c iphlpapi.a
Réponse acceptée
timo
le 28 Mar 2018
Modifié(e) : timo
le 28 Mar 2018
8 commentaires
Jean-Claude Arbaut
le 9 Avr 2018
Yes, but usually you do not see it. When you start Visual Studio's command line (not the IDE, but there are similar settings in the IDE), it runs vcvars64.bat or vcvars32.bat before you get to the command line.
These files are found in the VS installation directory, and they setup many environment variables needed by the compiler. You can see the list of environment variables by typing "set" in the console (some of them are set up by Windows, most come from vcvarsNN.bat).
Now, if for some reason the compiler does not find necessary include or library files, you can update the INCLUDE and LIB environment variables (or you can pass options to the compiler and/or linker directly).
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Support for MinGW-w64 C/C++ Compiler dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!