[Ipopt] linking library to lapack, gfortran

Andreas Waechter andreasw at watson.ibm.com
Mon Aug 10 10:47:53 EDT 2009


Hi Ashutosh,

I understand what you are saying, but it will probably take me some time 
to fix this (and I don't have that right now).  Could you please make this 
a ticket at the Ipopt Trac page?  I'm not sure when I would get to this, 
but at least that way it won't become forgotten and should be fixed at 
some point.  It's a libtool issue, and fixing those can be a hassle.

In the meantime, Ipopt installs a file

IPOPTINSTALLDIR/share/doc/coin/Ipopt/ipopt_addlibs_cpp.txt

This contains all additional link flags that you need in addition to 
-lipopt.  This would be required anyway if you compile Ipopt as a static 
library.  What I do in my Makefiles then is to have a

ADDLINKFALGS = `cat $(IPOPTINSTALLDIR)/share/doc/coin/Ipopt/ipopt_addlibs_cpp.txt)`

to read those.

If you are giving away binaries of your application (even if it is a 
library) that uses Ipopt you could compile the Ipopt library as static 
libraries (using --disable-shared in the configure command line), and then 
include the Ipopt object code in your shared object or executable 
directly.  If you are on 64bit systems, you will need to add

ADD_CXXFLAGS='-fPIC' ADD_FFLAGS='-fPIC' ADD_CFLAGS='-fPIC'

to the configure command line, so that the objects can be used in your 
shared library.

Thanks,

Andreas

On Sat, 8 Aug 2009, Ashutosh Mahajan wrote:

> i am wondering why does libipopt.so not link to libgfortran and liblapack,
> even though it needs them. if i have a simple C code that i need to link with
> ipopt, i need to add -llapack and -lgfortran even though my code does not use
> anything from these libraries. its not a show stopper but still a bit of
> annonyance (and gets aggravated, when someone else needs to link to my library).
>
> libClp on the other hand does seem to link to such libraries.
> $ ldd libClp.so
>        linux-vdso.so.1 =>  (0x00007fff38dfe000)
>        liblapack.so.3gf => /usr/lib/atlas/liblapack.so.3gf (0x00007f732ff03000)
>        libblas.so.3gf => /usr/lib/atlas/libblas.so.3gf (0x00007f732f552000)
>        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f732f247000)
>        libm.so.6 => /lib/libm.so.6 (0x00007f732efc6000)
>        libc.so.6 => /lib/libc.so.6 (0x00007f732ec64000)
>        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f732ea55000)
>        /lib64/ld-linux-x86-64.so.2 (0x00007f7330c34000)
>
>
> --
> regards
> Ashutosh Mahajan
> http://coral.ie.lehigh.edu/~asm4
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
>
>



More information about the Ipopt mailing list