[Ipopt] How to compile a .DLL on Windows 7 with MINGW
Tony Kelman
kelman at berkeley.edu
Fri Aug 23 22:20:26 EDT 2013
Are you using GNU compilers with MinGW/MSYS? I'm not sure if this dll will
actually work, but I was able to at least create a libipopt.dll. Go to
build/Ipopt/src/Interfaces, open the Makefile. Find the rule for
libipopt.la, and right after it add the following new rule:
libipopt.dll: $(libipopt_la_OBJECTS) $(libipopt_la_DEPENDENCIES)
$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -shared -o
$@ \
-Wl,-rpath,$(libdir) $(libipopt_la_LDFLAGS) IpInterfacesRegOp.o
IpIpoptApplication.o \
IpSolveStatistics.o IpStdCInterface.o IpStdFInterface.o \
IpStdInterfaceTNLP.o IpTNLPAdapter.o IpTNLPReducer.o \
`cat ../../../share/coin/doc/Ipopt/ipopt_addlibs_cpp.txt`
Make sure all but the first line starts with a tab character, sorry my email
program is force-replacing them with spaces.
Then (assuming you've already done make install at the top level) run make
libipopt.dll in this build/Ipopt/src/Interfaces directory. The dll will
probably depend on several of the MinGW GCC dll's, but you can possibly link
those statically into the dll by adding -static between $(LDFLAGS)
and -shared.
As I said, no idea if this dll will work, I use static linking for almost
everything. Why do you need a dll, can't you statically link to libipopt.a?
-Tony
-----Original Message-----
Date: Fri, 23 Aug 2013 11:16:30 +0200
From: Stefan Vigerske <stefan at math.hu-berlin.de>
To: "Steimel, Jochen" <Jochen.Steimel at bci.tu-dortmund.de>
Cc: ipopt at list.coin-or.org
Subject: Re: [Ipopt] How to compile a .DLL on Windows 7 with MINGW
Hi,
configuring Ipopt with the --enable-shared option should change the
compiler flags from -MT to -MD, despite the message you get.
After make install, the lib directory should have some .lib files. There
should be some way to make a .dll out of these libs, see, e.g.,
http://stackoverflow.com/questions/2384932/converting-static-link-library-to-dynamic-dll
Note, that there is also an option to allow for loading HSL code
dynamically from a DLL via the "linear solver loader", see
http://www.coin-or.org/Ipopt/documentation/node13.html#SECTION00043600000000000000
However, I'm not sure that this option is indeed enabled in the .DLL
that you are using.
For cygwin, all that I know is
http://www.coin-or.org/Ipopt/documentation/node15.html#SECTION00045100000000000000
which is taken from http://www.mpclab.net/Trac/wiki/CompilingIpopt
Stefan
On 08/23/2013 09:51 AM, Steimel, Jochen wrote:
> Dear all,
>
>
>
> i am trying to compile a Windows .DLL of IPOPT to use in my own modeling
> environment. Right now, I am using the precompiled binary but it seems
> to me that the included MUMPS Solver is not ideal for the problems I
> need to get solved.
>
>
>
> I decided to compile the IPOPT sourcecode in order to get access to the
> HSL Solvers MA27 and MA57. I followed the steps in the manuscript
> "Compiling IPopt and the Ipopt MATLAB interace under Windows".
>
>
>
> I run a Windows 7 single-core 32-bit system.
>
> I have installed MinGW 20111118
>
> I downloaded the most recent IPOPT sourcecode and tried several other
> versions
>
> I obtained all required third-party code
>
>
>
> When in run the configure script with "-enable-shared" I get the error
> message "Error: Shared libraries are not avaiblable on MSYS. I am
> disabling your option"
>
>
>
> After running the make scripts I obtain the file "ipopt.exe" (which, as
> I assume, contains the AMPL interface) but no DLL.
>
>
>
> So my question is: Is it possible to compile a Windows DLL of IPOPT on
> MINGW in order to get access to the HSL solvers, or am I restricted to
> using MUMPS forever?
>
>
>
> I have also tried installing CYGWIN, but here I am not able to get all
> compilers and subprograms running. Is there a tutorial for setting up
> Cygwin for the compilation of IPOPT?
>
>
>
> Regards
>
> Jochen Steimel
More information about the Ipopt
mailing list