現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)