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

Dino Hüllmann hdino at student.ethz.ch
Thu Mar 7 09:24:24 EST 2013


Tony,

I tried what you suggested, but I still have the undefined references:

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*, ...)'

The link command contains: -LC:/MinGW64/msys/home/Dino/trunk/build/lib 
-lipopt
and libipopt.a is at the specified path, so that should work.

I removed the Snprintf calls in matlabexception.cpp experimentally, but 
then the next undefined references arise.

Might this problem be due to a 32/64 bit mixup?


Regards
Dino



Am 07.03.2013 04:18, schrieb Tony Kelman:
> Dino,
>
> 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.
>
> -Tony
>
>
> -----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)
>
> Hi,
>
> 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*, ...)'
> c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: 
>
> matlabexception.o: bad reloc address 0x0 in section
> `.pdata$_ZNK15MatlabException4whatEv'
> collect2.exe: error: ld returned 1 exit status
> link command: g++ -shared
> C:\MinGW64\msys\home\Dino\trunk\Ipopt\contrib\MATLAB~1\gnumex\libdef\mex.def 
>
> -o ipopt.mexw64
> -LC:\MinGW64\msys\home\Dino\trunk\Ipopt\contrib\MATLAB~1\gnumex\libdef
> -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\msys\home\Dino\trunk\build\lib\libipopt.lib
> C:\MinGW64\msys\home\Dino\trunk\build\lib\libcoinmumps.lib
> 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'
> failed.
>
> 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
> make install
>
> Then I ran
> make gnumex
> duplicated all necessary libraries, renamed their file extension to .lib
> (is there a better way?) and
> make
>
>
> Thanks and kind regards
> Dino
>



More information about the Ipopt mailing list