이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Error using mex (no description of error)
조회 수: 2 (최근 30일)
이전 댓글 표시
Hey all,
So I'm trying to compile an example .c program from http://www.mathworks.com/help/matlab/matlab_external/install-mingw-support-package.html and I get the following message:
>> mex yprime.c
Building with 'MinGW64 Compiler (C)'.
Error using mex
With no other description... I don't even know where to start looking.
댓글 수: 10
James Tursa
2016년 1월 23일
Try verbose setting to maybe get an idea of what is going on
mex -v yprime.c
Christopher Davis
2016년 1월 25일
편집: Christopher Davis
2016년 1월 25일
Thanks in advance!
I did configure with mex -setup.
calling the verbose setting returned:
>> mex -v yprime.c
Verbose mode is on.
Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require the use of
-largeArrayDims and remove the -compatibleArrayDims option.
For more information:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
... Looking for compiler 'MinGW64 Compiler (C)' ...
... Looking for environment variable 'MW_MINGW64_LOC' ...Yes ('C:\TDM-GCC-64').
... Looking for file 'C:\TDM-GCC-64\bin\gcc.exe' ...Yes.
... Looking for folder 'C:\TDM-GCC-64\' ...Yes.
Found installed compiler 'MinGW64 Compiler (C)'.
Set PATH = C:\TDM-GCC-64\\bin;C:\Program Files\MATLAB\R2015b\extern\include\win64;C:\Program Files\MATLAB\R2015b\extern\include;C:\Program Files\MATLAB\R2015b\simulink\include;C:\Program Files\MATLAB\R2015b\lib\win64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\libnvvp;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\MATLAB\R2015b\bin;C:\Program Files\MATLAB\R2015a\bin;C:\Users\d0harv3y\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\MATLAB\MATLAB Compiler Runtime\v82\runtime\win64;C:\Program Files\MATLAB\MATLAB Runtime\v85\runtime\win64;C:\Windows\System32;C:\TDM-GCC-64\bin
Set INCLUDE = %MW_MINGW64_LOC%\include;;
Set LIB = %MW_MINGW64_LOC%\lib;;
Set MW_TARGET_ARCH = win64;
Set LIBPATH = C:\Program Files\MATLAB\R2015b\extern\lib\win64;
Options file details
-------------------------------------------------------------------
Compiler location: C:\TDM-GCC-64\
Options file: C:\Users\d0harv3y\AppData\Roaming\MathWorks\MATLAB\R2015b\mex_C_win64.xml
CMDLINE1 : C:\TDM-GCC-64\\bin\gcc -c -DMX_COMPAT_32 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2015b/extern/include" -I"C:\Program Files\MATLAB\R2015b/simulink/include" -I"C:\Program Files\MATLAB\R2015b/extern\lib\win64\mingw64" -fexceptions -fno-omit-frame-pointer -O -DNDEBUG C:\Users\d0harv3y\Documents\MATLAB\yprime.c -o C:\Users\d0harv3y\AppData\Local\Temp\mex_779730424373645_7508\yprime.obj
CMDLINE2 : C:\TDM-GCC-64\\bin\gcc -m64 -Wl,--no-undefined -shared -s -Wl,"C:\Program Files\MATLAB\R2015b/extern/lib/win64/mingw64/mexFunction.def" C:\Users\d0harv3y\AppData\Local\Temp\mex_779730424373645_7508\yprime.obj -L"C:\Program Files\MATLAB\R2015b\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas -o yprime.mexw64
CC : C:\TDM-GCC-64\\bin\gcc
COMPILER : C:\TDM-GCC-64\\bin\gcc
DEFINES : -DMX_COMPAT_32 -DMATLAB_MEX_FILE
MATLABMEX : -DMATLAB_MEX_FILE
CFLAGS : -fexceptions -fno-omit-frame-pointer
INCLUDE : -I"C:\Program Files\MATLAB\R2015b/extern/include" -I"C:\Program Files\MATLAB\R2015b/simulink/include" -I"C:\Program Files\MATLAB\R2015b/extern\lib\win64\mingw64"
COPTIMFLAGS : -O -DNDEBUG
CDEBUGFLAGS : -g
LD : C:\TDM-GCC-64\\bin\gcc
LINKER : C:\TDM-GCC-64\\bin\gcc
LDTYPE : -shared
LDFLAGS : -m64 -Wl,--no-undefined
LINKEXPORT : -Wl,"C:\Program Files\MATLAB\R2015b/extern/lib/win64/mingw64/mexFunction.def"
LIBLOC : C:\Program Files\MATLAB\R2015b\extern\lib\win64\mingw64
LINKLIBS : -L"C:\Program Files\MATLAB\R2015b\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas
LDOPTIMFLAGS : -s
LDDEBUGFLAGS : -g
OBJEXT : .obj
LDEXT : .mexw64
SETENV : set COMPILER=gcc
set COMPFLAGS=-c -fexceptions -fno-omit-frame-pointer -DMX_COMPAT_32 -DMATLAB_MEX_FILE -DMATLAB_MEX_FILE
set OPTIMFLAGS=-O -DNDEBUG
set DEBUGFLAGS=-g
set LINKER=gcc
set LINKFLAGS=-m64 -Wl,--no-undefined -shared -L"C:\Program Files\MATLAB\R2015b\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -llibmwlapack -llibmwblas -Wl,"C:\Program Files\MATLAB\R2015b/extern/lib/win64/mingw64/mexFunction.def"
set LINKDEBUGFLAGS=-g
set NAME_OUTPUT=-o "%OUTDIR%%MEX_NAME%%MEX_EXT%"
MINGWROOT : C:\TDM-GCC-64\
MATLABROOT : C:\Program Files\MATLAB\R2015b
ARCH : win64
SRC : C:\Users\d0harv3y\Documents\MATLAB\yprime.c
OBJ : C:\Users\d0harv3y\AppData\Local\Temp\mex_779730424373645_7508\yprime.obj
OBJS : C:\Users\d0harv3y\AppData\Local\Temp\mex_779730424373645_7508\yprime.obj
SRCROOT : C:\Users\d0harv3y\Documents\MATLAB\yprime
DEF : C:\Users\d0harv3y\AppData\Local\Temp\mex_779730424373645_7508\yprime.def
EXP : yprime.exp
LIB : yprime.lib
EXE : yprime.mexw64
ILK : yprime.ilk
MANIFEST : yprime.mexw64.manifest
TEMPNAME : yprime
EXEDIR :
EXENAME : yprime
OPTIM : -O -DNDEBUG
LINKOPTIM : -s
-------------------------------------------------------------------
Building with 'MinGW64 Compiler (C)'.
C:\TDM-GCC-64\\bin\gcc -c -DMX_COMPAT_32 -DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2015b/extern/include" -I"C:\Program Files\MATLAB\R2015b/simulink/include" -I"C:\Program Files\MATLAB\R2015b/extern\lib\win64\mingw64" -fexceptions -fno-omit-frame-pointer -O -DNDEBUG C:\Users\d0harv3y\Documents\MATLAB\yprime.c -o C:\Users\d0harv3y\AppData\Local\Temp\mex_779730424373645_7508\yprime.obj
Error using mex
I'm not sure what I'm looking for.
Walter Roberson
2016년 1월 26일
What do you get if, inside MATLAB, you execute
!C:\TDM-GCC-64\\bin\gcc --version
?
Christopher Davis
2016년 1월 26일
I don't get anything when executing that line inside matlab.
>> !C:\TDM-GCC-64\\bin\gcc --version
>>
But if I do the same line without the ! in command prompt I get
C:\Windows\system32>C:\TDM-GCC-64\\bin\gcc --version
gcc (tdm64-1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Walter Roberson
2016년 1월 26일
You appear to have a conflict of runtime libraries. This is the sort of thing you would use Dependency Walker to trace down.
Jeevan Joishi
2016년 1월 29일
I understand that you are using MATLAB R2015b. It is quite unusual that the following code is returning an empty output.
!C:\TDM-GCC-64\\bin\gcc --version
It might be a possibility that the path to minGW is not present in the MATLAB path. You can verify this by typing
>> path
on the MATLAB prompt and verifying the result. An entry similar to that mentioned below should appear
C:\MATLAB\upportPackages\R2015b\mingw\mex\supportpackages\mingw
Also, an entry similar to that mentioned below should appear on the PATH environment variable on the system.
C:\TDM-GCC-64\bin
I see that there are no spaces in the path to GCC, which is the correct way of doing it. Spaces in the path to GCC if any, will cause to the call to gcc to error out.
Also, just to rule out other possibilities, are you able to compile to the program 'yprime.c' using any other compiler?
Christopher Davis
2016년 1월 29일
편집: Christopher Davis
2016년 1월 29일
Sorry Walter, at the time I did not realize these two issues were linked. So, for some reason any system command that I put into matlab is returning an empty string.
>> command = 'pwd';
>> [status, cmdout] = system(command);
in workspace:
cmdout=''
command='pwd'
status=-1
I have not used dependency walker before. I got it and ran matlab through it, but I don't know how to make sense of the output. There's so many messages... I hesitate to paste it here.
Also I checked and both of those entries appear in the matlab path and the environment variable PATH.
OK, I think* this is the message I get from dependency walker associated with the call to mex:
LoadLibraryA("c:\program files\matlab\r2015b\bin\win64\mex_builtin.dll") called from "LIBUT.DLL" at address 0x000000000450410D.
Loaded "MEX_BUILTIN.DLL" at address 0x000000001E270000. Successfully hooked module.
Loaded "LIBMEXCMD.DLL" at address 0x000000001E2B0000. Successfully hooked module.
DllMain(0x000000001E2B0000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "LIBMEXCMD.DLL" called.
DllMain(0x000000001E2B0000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "LIBMEXCMD.DLL" returned 1 (0x1).
DllMain(0x000000001E270000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "MEX_BUILTIN.DLL" called.
DllMain(0x000000001E270000, DLL_PROCESS_ATTACH, 0x0000000000000000) in "MEX_BUILTIN.DLL" returned 1 (0x1).
LoadLibraryA("c:\program files\matlab\r2015b\bin\win64\mex_builtin.dll") returned 0x000000001E270000.
GetProcAddress(0x000000001E270000 [MEX_BUILTIN.DLL], "QueryMLFcnTable_mex_builtin") called from "LIBUT.DLL" at address 0x0000000004504819 and returned 0x000000001E28B7D0.
GetProcAddress(0x000000001E270000 [MEX_BUILTIN.DLL], "MLInitialize_mex_builtin") called from "LIBUT.DLL" at address 0x0000000004504819 and returned 0x000000001E28B7A0.
GetProcAddress(0x000000001E270000 [MEX_BUILTIN.DLL], "MLTerminate_mex_builtin") called from "LIBUT.DLL" at address 0x0000000004504819 and returned 0x000000001E28B7C0.
Loaded "" at address 0x000000001E390000. Successfully hooked module.
Unloaded "" at address 0x000000001E390000.
> throw_segv_longjmp_seh_filter()
throw_segv_longjmp_seh_filter(): C++ exception
< throw_segv_longjmp_seh_filter() = EXCEPTION_CONTINUE_SEARCH
Christopher Davis
2016년 2월 5일
The attached file is a profile of matlab from dependency walker after trying to run
>> mex yprime.c
I have no experience with dependency walker, so if someone who does see this and has the time to look at it, please do.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)