我已将cygwin设置为MATLAB 2016b的mex编译器,方法是将环境变量 MW_MINGW64_LOC 设置为 G:\ cygwin64 。然后我测试了一些简单的例子。 cygwin中的g ++可以很好地用作编译器。但是,当我调用编译的mexw64函数时,matlab崩溃并且错误消息如下:
MATLAB crash file:C:\Users\yh\AppData\Local\Temp\matlab_crash_dump.6792-1:
------------------------------------------------------------------------
Access violation detected at Mon Jan 08 19:18:18 2018
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Current Graphics Driver: Unknown hardware
Default Encoding : windows-1252
Deployed : false
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA Quadro K1100M Version 21.21.13.6937
Graphics card 2 : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 4600 Version 20.19.15.4474
Host Name : Lenovo-PC
MATLAB Architecture : win64
MATLAB Entitlement ID: Unknown
MATLAB Root : C:\Program Files\MATLAB\R2016b
MATLAB Version : 9.1.0.441655 (R2016b)
OpenGL : hardware
Operating System : Microsoft Windows 10 Pro
Processor ID : x86 Family 6 Model 60 Stepping 3, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Version 10.0 (Build 14393)
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
RAX = 0000000000000020 RBX = 0000000000000000
RCX = 00000000000000a1 RDX = 00000001003c4280
RSP = 00000000043fb360 RBP = 00000000043fb3c0
RSI = 000000002aedd590 RDI = 00000000000000a1
R8 = 0000000000000000 R9 = 0000000000008000
R10 = 0000000004400000 R11 = 0000000327edab14
R12 = 00000000043fbfc0 R13 = 00000000e2c041c0
R14 = 000000000000127f R15 = 0000000000000000
RIP = 00000000900c97d7 EFL = 00010206
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x00000000900c97d7 G:\cygwin64\bin\cygwin1.dll+00890839
[ 1] 0x000000009006adaf G:\cygwin64\bin\cygwin1.dll+00503215
[ 2] 0x00000000900c97ea G:\cygwin64\bin\cygwin1.dll+00890858
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
我还测试了其他matlab支持的编译器,例如MSVS 2017和MinGW64。得到的mex函数在不关闭matlab的情况下运行良好。
由于我有一些其他代码只能使用cygwin而不是MSVS或MinGW64编译,我可否知道如何解决上述问题?对于这些代码,我已成功使用cygwin获取exe文件并且运行正常。
提前多多感谢!