Has anyone been able to get mym (http://sourceforge.net/projects/mym/) to build on a 64-bit Win7 machine? And if so would you mind posting or linking your steps to do so?
My particulars: Windows 7 Enterprise, 64-bit OS MATLAB Version 220.127.116.114 (R2011b) Microsoft VS 2010 Ver. 10.0.30319.1 MySQL Ver 14.14 Distrib 5.5.21, for Win64 (x86)
I ran "mex -setup" and I was able to compile and run "yprime.c"
I downloaded and installed zlib (http://www.zlib.net/), which is what the readme file for mym says to do.
Here is the mex command that I am using:
mex -IC:\zlib-1.2.6 -I'C:\Program Files\MySQL\Connector C 6.0.2\include' ... -L'C:\Program Files\MySQL\Connector C 6.0.2\lib\opt' ... -L'C:\zlib-1.2.6' -lzlib -lmysqlclient mym.cpp
I get a bunch of "already defined in MSVCRT.lib" error messages. e.g.:
LIBCMT.lib(tidtable.obj) : error LNK2005: _encoded_null already defined in MSVCRT.lib(MSVCR100.dll) LIBCMT.lib(invarg.obj) : error LNK2005: _set_invalid_parameter_handler already defined in MSVCRT.lib(MSVCR100.dll) LIBCMT.lib(crt0dat.obj) : error LNK2005: _initterm_e already defined in MSVCRT.lib(MSVCR100.dll)
I admit that I'm stumped at this point and there is not a whole lot of helpful info out there on the world wide web.
From my notes, here are the steps that I took to get this to work (Note: I'm no longer working on the project that needed this so I hope things haven't changed since I did this)
- Install 32-bit MATLAB if not already available. (I believe mym requires 32-bitbit MATLAB though I am not 100% sure about this.)
- Download zlib source code (http://www.zlib.net/). The version that I downloaded was 1.2.6; the source was contained in a zip archive called zlib126.zip
- Unzip the zlib source code and place in desired location—I placed contents in folder “C:\zlib 1.2.6”
- Download zlib124_masm_obj.zip (http://www.findthatfile.com/search-37735452-hZIP/winrar-winzip-download-zlib124_masm_obj.zip.htm). (NOTE: After building zlib while writing these notes, I noticed that there is a zlib125_masm_obj.zip available.)
- Copy the contents of the directory “contrib\masmx86” in the zip archive to the directory “...\zlib 1.2.6\contrib\masmx86” directory (NOTE: This step was necessary because when I tried to build zlib I got an error message regarding missing files. I don’t remember how or where I found the solution to this. I forgot to note the web site. I found the link listed in step 4 while writing these notes.)
- Build zlib with Microsoft Visual Studio 2010: a. Double-click file the MVS solution file, zlibvc.sln, in folder “...\zlib 1.2.6\contrib\vstudio\vc10\” to start MVS2010. (NOTE: When I did this I got six projects listed under solution zlibvc.) b. Build the project. (NOTE: When I did this, only project zlibvc built successfully but that was the only one I needed. Also, I set the project properties so that the Configuration was a Release build instead of a Debug build.) c. Verify that zlibwapi.lib is generated in the folder “...\zlib 1.2.6\contrib\vstudio\vc10\x86\ZlibDllRelease”.
- Download mym (http://sourceforge.net/projects/mym/). The version that I installed was 1.36. The source was contained in a zip archive called mym_src_v1.36.zip.
- Unzip the mym archive and place the contents in desired location—I placed contents in folder C:\Users\dossow1\Documents\MATLAB\mym_src_v1.36
- Copy the file msvc100opts.bat from the directory “C:\Program Files (x86)\MATLAB\R2011b\bin\win32\mexopts” to the directory where mym was stored.
- Edit the msvc100opts.bat file to add option “/NODEFAULTLIB:LIBCMTD” to the “set LINKFLAGS” line.
- Start MATLAB, cd to the directory where mym was stored, and compile mym with the following command:
mex -f .\msvc100opts.bat -I'C:\zlib-1.2.6' -I'C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include' ... -L'C:\zlib-1.2.6\contrib\vstudio\vc10\x86\ZlibDllRelease' ... -L'C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\lib\opt' ... -llibmysql -lzlibwapi .\mym.cpp
- Do one of the following: a. Copy the following DLL’s to the directory where mym is stored: i. zlibwapi.dll from “...\zlib-1.2.6\contrib\vstudio\vc10\x86\ZlibDllRelease” ii. libmysql.dll from “...\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\lib\opt” b. Add the directories where zlibwapi.dll and libmysql.dll are located to the system path (via Control Panel| Advanced System Properties | Environment Variables | System Variables | Path)
Now mym should be ready to run!!