This conversation contains a discussion with the Mathworks regarding changes to MATLAB that affected our MinGW (GCCfor Windows) based MEX replacement. The fundamental motivation for the alternative build environment is to support the creation of MEX files that depend on open-source libraries which are typically easier to build in the GCC environment.
Forwarded conversationSubject:
Re: Why does MATLAB 7.4 (R2007a) not include DEF-files for MEX libraries?
------------------------
From: <sup...@mathworks.com>
Date: 21 May 2007 08:57:19 -0400
To: hk...@cornell.edu
Hello Harold,
I am writing in reference to your Service Request # 1-4BN8YT regarding 'Why does MATLAB 7.4 (R2007a) not include DEF-files for MEX libraries?'.
Between R2006b and R2007a, we upgraded our internal build compiler for Windows from Microsoft Visual C++ .NET 2003 (7.1) to Microsoft Visual Studio C++ 2005 (8.0). I suspect that this may be part of the issue.
I will investigate further, and contact you when I have additional information.
Sincerely,
Ken Mitton
Application Support Engineer
Technical Support Department
The MathWorks, Inc.
Phone:
(508) 647-7000 option 5
Email:
sup...@mathworks.comSelf-Service:
http://www.mathworks.com/supportFile Exchange and Newsgroup Access:
http://www.mathworks.com/matlabcentral/[THREAD ID: 1-4BN8YT]
----------
From: Harold Figueroa <harold....@gmail.com>
Date: May 21, 2007 8:50 AM
To: sup...@mathworks.com
Hello Ken,
Here is some more information to explain my concern.
I have a community project, available at
xbat.org that that critically uses various open-source libraries through the MEX interface. It is easiest to build these, and I am sure many other libraries using the MinGW tools under windows. We use these tools as well to build our MEX files, we have encountered problems linking using lcc, and the microsoft compiler presents various problems as well. You can look at the project (under Core/Build) if you are interested in the details.
We are currently trying to support versions of MATLAB from version 7 on, our main platform is windows. We have encountered binary incompatibilities between the various 7 versions under windows. We use 7.1 compiled MEX files for
7.0-7.2, and 7.3 compiled MEX files for 7.3-7.4, and we expect that these will continue, something we can handle as long as we can continue to build.
Harold----------
From: <sup...@mathworks.com>
Date: 21 May 2007 13:00:50 -0400
To: harold....@gmail.com
1. Thank you for the clarification. Your choices of binary versions in particular seems appropriate; for example, the 64-bit mxArray indices added in 7.3 caused several significant changes to these libraries.
2. For similar projects, we have had success in using the LIBTOOL supplied with MinGW to extract symbol information. Have you tried this approach for the newer versions of our libraries?
This is my preferred approach --- it will be easiest to continue into the future.
3. With MATLAB 7.4 (R2007a), we have had success using older DEF-files. While this can provide a stopgap measure for some users, it does not seem to be practical for your project. In particular, future versions of MATLAB may need access to symbols not used in the R2006b libraries.
Have you had difficulties using LIBTOOL with these libraries? If so, please supply specifics --- we believe LIBTOOL and similar utilities for other unsupported compilers should be able to produce the appropriate data for these libraries.
----------
From: Harold Figueroa <harold....@gmail.com>
Date: May 21, 2007 1:07 PM
To: sup...@mathworks.com
Hello again,
This is reasonable, however it is not easy to gather from the documentation or from the message produced when MEX files fail to load .... 'invalid MEX file' ...
I think you are referring to dlltool, a perhaps related tool. libtool per se does not seem to be included as part of the MinGW distribution, it is available through the GnuWin32 project, examining it suggests that is used at a different point in the process, when creating the actual libraries to start with ... something you use when starting from .o or .so files I think. If there is a specific way of using libtool from the dll, I would be interested in knowing about it.
The following link describes how to use dlltool, when starting from a dll:
http://www.mingw.org/MinGWiki/index.php/CreateImportLibraries
My results using this tool on the required dll's are as follows ... the key point is 'no symbols' ...
"C:\XBAT_HEART\Tools\MinGW\bin\dlltool.exe" -z libmat.def --export-all-symbol "C:\Program Files\MATLAB\R2007a\bin\win32\libmat.dll"
C:\XBAT_HEART\Tools\MinGW\bin\dlltool.exe: C:\Program Files\MATLAB\R2007a\bin\win32\libmat.dll: no symbols
"C:\XBAT_HEART\Tools\MinGW\bin\dlltool.exe" -z libmex.def --export-all-symbol "C:\Program Files\MATLAB\R2007a\bin\win32\libmex.dll"
C:\XBAT_HEART\Tools\MinGW\bin\dlltool.exe: C:\Program Files\MATLAB\R2007a\bin\win32\libmex.dll: no symbols
"C:\XBAT_HEART\Tools\MinGW\bin\dlltool.exe" -z libmx.def --export-all-symbol "C:\Program Files\MATLAB\R2007a\bin\win32\libmx.dll"
C:\XBAT_HEART\Tools\MinGW\bin\dlltool.exe: C:\Program Files\MATLAB\R2007a\bin\win32\libmx.dll: no symbols
We have been successful using the older files as well, as described in an earlier message:however we are concerned for the future.
I described this above, the dll's appear to have been stripped of symbol information
Harold
----------
From: <sup...@mathworks.com>
Date: 23 May 2007 10:34:16 -0400
To: harold....@gmail.com
1. The symbol extraction I was remembering appears to be in the REIMP tool:
http://www.mingw.org/mingwfaq.shtml#faq-msvcdll
Is your version of REIMP able to pull the symbols from our DLLs?
2. We may consider producing and supplying these DEF-files again. We will contact you when more information is available from these discussions.
We are currently trying to support versions of MATLAB from version 7on, our main platform is windows. We have encountered binaryincompatibilities between the various 7 versions under windows. We use7.1 compiled MEX files for 7.0-7.2, and 7.3 compiled MEX files for7.3-7.4, and we expect that these will continue, something we canhandle as long as we can continue to build.