[Ipopt] MinGW problems
Rodrigo Lopez-Negrete
r.lopez.negrete at gmail.com
Sun Nov 28 20:40:14 EST 2010
Hi Hans and Jens,
I just tried compiling the matlab interface again. I was able to do it
following *some* of my instructions on the Ipopt website. Here's what I did.
I used a clean install of MinGW/Msys with the newest available installer
from the MinGW website (mingw-get-inst-20101030.exe). I'm using Windows XP
and the compilers that come with the MinGW download:
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.0/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.0/configure
--enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions
--with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry
--enable-libstdcxx-debug --enable-version-specific-runtime-libs
--disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.0 (GCC)
I configured Ipopt using
$ ../configure -C --enable-doscompile --enable-static --disable-shared
ADD_CXXFLAGS="-fexceptions" ADD_CFLAGS="-fexceptions"
ADD_FFLAGS="-fexceptions"
Make the ipopt library. All tests passed for me.
Then I generated the mexopts.bat file using gnumex. This file I copied to
the $IPOPT/build/Ipopt/contrib/MatlabInterface/src folder, and I modified it
as follows:
set GM_MEXLANG=cxx
set GM_ADD_LIBS= -llibmx -llibmex -llibmat
-Lc:/MinGW/msys/uno/home/testnew/Ipopt/build/lib/coin
-Lc:/MinGW/msys/uno/home/testnew/Ipopt/build/lib/coin/ThirdParty -lipopt
-lcoinhsl -lcoinmetis -lcoinmumps -lcoinlapack -lcoinblas -Lc:/MinGW/lib
-LC:/MinGW/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.5.0
-Lc:/mingw/bin/../lib/gcc
-Lc:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/lib
-Lc:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../.. -L/mingw/lib -lgfortran
-lmingw32 -lgcc_s -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32
-ladvapi32 -lshell32 -lpthread -lm
set COMPILER=g++
The makefile I setup like this (as per my Matlab installation)
1. MATLAB_HOME = /c/PROGRA~1/MATLAB/R2009a/
2. MEXSUFFIX = mexw32
3. MEX = $(MATLAB_HOME)/sys/perl/win32/bin/perl.exe $(MATLAB_HOME)/bin/
mex.pl
4. remove the -cxx flag from MEXFLAGS
When doing make for the Matlab interface it complains about not finding the
'm' library, however it compiles and generates the ipopt.mexw32 file. I
tested it with the examples, and it worked.
I hope this helps. If you try this and it works, let me know. I may update
the Ipopt website.
Best,
Rodrigo
On Thu, Nov 25, 2010 at 4:01 AM, Jens Schubert <
jens.schubert.1 at googlemail.com> wrote:
> Hi Hans,
>
> > I used tdm-gcc-4.3.2 as described in the compulation hints.
> I just checked the mingw home page. I found that the documentation was
> updated since I had read it last time. However, go to
> http://www.mingw.org/wiki/InstallationHOWTOforMinGW
> and scroll down to 'Manual Installations'. Follow all the instructions
> - this will need some time. I checked a few links, for me it looks
> like they point all to the gcc4.5 version. So here you will get all
> the necessary packages.
>
> Then, after you updated to the newest version of gcc, try to use it.
> In my gcc-version (4.5.0-1) the compiler did not yet work fully
> correctly, that is why one had to set the linker-option ( I found this
> in the release notes). [I just see that this version is the same as
> the version suggested on the mingw page.]
>
> >
> >> For me it works with gcc4.5.0 and using the linkeroption
> >> '--enable-runtime-pseudo-reloc-v2' durch '--enable-auto-import'.
> >
> > I'm not sure what exactly you mean - can you clarify where I need to
> > specify which of these options?
> Well, this depends on your environment. I work in the 'msys'-shell as
> suggested on the mingw home page. If gcc is called,
> (a) either directly by typing on the msys command-prompt,
> (b) or by a make-tool
> (c) or by some other program
> there is always a way to set the compiler options. In my case (b) I
> just put it as an option behind the gcc-comand in the makefile.
>
> > Can you tell me why you chose these
> > options?
> See above: I found it in the release notes.
> The (nearly) complete list of all options may be found in the gcc manual.
> http://gcc.gnu.org/onlinedocs/
> But the list is too long for just reading it, you need to use the list
> as reference for looking up unknown things.
>
>
> Good luck
> Jens Schubert
>
> >
> > Thanks for your help!
> >
> > Hans
> >
> >>
> >> Hope it helps
> >> Jens
> >>
> >>
> >> 2010/11/24 Hans Pirnay <hans.pirnay at rwth-aachen.de>:
> >>> Hi everyone,
> >>>
> >>> I am trying to compile Ipopt for Windows so I might finally be able to
> >>> use it for Matlab, but I ran into problems using Rodrigo's guide on
> >>> https://projects.coin-or.org/Ipopt/wiki/CompilationHints
> >>>
> >>> I set up a MinGW system, and successfully ran configure and make with
> >>> the same options Rodrigo used. However, any executables I create (all
> >>> examples, as well as running make test) compile fine, but fail at
> >>> runtime with the usual
> >>>
> >>> "hs071_cpp.exe has encountered a problem and needs to close. --- Send
> >>> Error Report / Don't Send" - window.
> >>>
> >>> I tried to compile a simple helloworld program just to check if any
> >>> code compiled on MinGW fails, but that worked fine.
> >>>
> >>> Has anyone encountered and overcome this problem before? Any help is
> >>> appreciated!
> >>>
> >>> thanks
> >>>
> >>> Hans
> >>>
> >>> _______________________________________________
> >>> Ipopt mailing list
> >>> Ipopt at list.coin-or.org
> >>> http://list.coin-or.org/mailman/listinfo/ipopt
> >>>
> >>
> >
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
>
--
*Rodrigo López-Negrete de la Fuente*
Doctoral Candidate
Email: rln at cmu.edu
WWW: http://rodrigo.lopez-negrete.org
Department of Chemical Engineering
Carnegie Mellon University
5000 Forbes Ave.
Pittsburgh, PA 15213-3890
USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/ipopt/attachments/20101128/93508541/attachment.html
More information about the Ipopt
mailing list