[Ipopt] Building Ipopt Matlab Interface (Win, 64 bit)

Tony Kelman kelman at berkeley.edu
Wed Mar 6 22:18:23 EST 2013


Sorry this isn't fully documented yet. I was meaning to make an updated wiki 
page with all the instructions to build the Matlab interface on Linux, Mac, 
and Windows in one place, once there is a new stable pre-release branch 
containing my changes relative to 3.10.x.

You need to run "make gnumex" before building the mex file - so try
make clean gnumex install
and let me know if that works.

You don't need to rename the libraries to .lib. During the call to mex, it 
will complain with a bunch of warnings if it can't find the libraries under 
.lib extension, but the link command will use MinGW g++ so they should be 
linked either with -L$IPOPT_LIB_DIR -lipopt or $IPOPT_LIB_DIR/libipopt.a, 
same as in Linux.


-----Original Message----- 
From: Dino H?llmann <hdino at student.ethz.ch>
Date: Wed, 6 Mar 2013 14:20:23 +0100
To: <ipopt at list.coin-or.org>
Subject: [Ipopt]  Building Ipopt Matlab Interface (Win, 64 bit)


I'd like to write a tutorial for using Ipopt from a 64 bit Matlab.

Though, I encounter the following error when trying to build the 64 bit
Matlab Interface:

matlabexception.o:matlabexception.cpp:(.text+0x91): undefined reference
to `Ipopt::Snprintf(char*, long, char const*, ...)'
matlabexception.o:matlabexception.cpp:(.text+0x195): undefined reference
to `Ipopt::Snprintf(char*, long, char const*, ...)'
matlabexception.o:matlabexception.cpp:(.text+0x22d): undefined reference
to `Ipopt::Snprintf(char*, long, char const*, ...)'
matlabexception.o: bad reloc address 0x0 in section
collect2.exe: error: ld returned 1 exit status
link command: g++ -shared
-o ipopt.mexw64
-s matlabexception.o matlabfunctionhandle.o matlabjournal.o iterate.o
ipoptoptions.o options.o sparsematrix.o callbackfunctions.o matlabinfo.o
matlabprogram.o ipopt.o
C:\mingw64\lib\gcc\x86_64-w64-mingw32\4.7.1\libgfortran.lib [all the
other libs] C:\mingw64\lib\gcc\x86_64-w64-mingw32\4.7.1\libm.lib -static
-llibmx -llibmex -llibmat

   C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Link of 'ipopt.mexw64'

The system setup is as follows:
Windows 7 64 bit
MATLAB R2012a 64 bit
TDM GCC 64 (gcc, g++, gfortran 4.7.1)
Ipopt trunk from svn

The Ipopt libs were build successfully using
../configure ADD_FFLAGS="-static-libgcc" CDEFS="-DWITHOUT_PTHREAD=1"
make install

Then I ran
make gnumex
duplicated all necessary libraries, renamed their file extension to .lib
(is there a better way?) and

Thanks and kind regards

More information about the Ipopt mailing list