[Ipopt] Library dependency issue?

Stefan Vigerske stefan at vigerske.de
Sun Jun 1 10:03:18 EDT 2008


Hi,

> When I build IPOPT, with just static linking to HSL routines, I end up 
> with the following library dependencies:
> 
> john at roadwork:~/Ipopt-3.4.0/Ipopt/examples/hs071_c$ ldd 
> /usr/local/lib/libipopt.so
>     linux-gate.so.1 =>  (0xb7fb3000)
>     libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7cea000)
>     libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7bf7000)
>     libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7bd1000)
>     libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7a82000)
>     libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7a77000)
>     /lib/ld-linux.so.2 (0xb7fb4000)
> 
> However when I look at the missing symbols in the shared library, I see
> 
> john at roadwork:~/Ipopt-3.4.0/Ipopt/examples/hs071_c$ nm !$ | grep gfort
> nm /usr/local/lib/libipopt.so | grep gfort
>          U _gfortran_st_write
>          U _gfortran_st_write_done
>          U _gfortran_transfer_character
>          U _gfortran_transfer_integer
>          U _gfortran_transfer_real
> 
> So it looks like IPOPT needs symbols from libgfortran, but it doesn't 
> have a library dependency on libgfortran.so.X.
> 
> This means that in order to use IPOPT correctly, I must always have 
> '-lgfortran'. 

Yes, these kinds of flags are stored in the ipopt_addlibs_cpp.txt file 
that is generated during the Ipopt build, see
https://projects.coin-or.org/BuildTools/wiki/user-examples#LinkingyourCodewithCOINLibraries

It can be seen as a simple replacement of the ipopt-config script that 
you proposed in the other posting.

> My understanding is that if IPOPT included its own 
> dependency upon libgfortran.so.XXX then I wouldn't need to explicitly 
> add this '-lgfortran' linkage myself. Furthermore, if the gfortran on my 
> system were updated between the time that IPOPT were built and my 
> program were linked to it, then it's possible that ABI incompatibilities 
> between the gfortran libs could occur.

Yes, I agree that this could happen.

> I suspect that maybe there should be library dependencies on BLAS and 
> LAPACK, as well,  but maybe I'm wrong there.

If Lapack and Blas are installed on the system and these are used by 
Ipopt, then the flags go into ipopt_addlibs_cpp.txt. Otherwise, that is 
if Lapack and Blas from ThirdParty are build and used, then the libs are 
included into the Ipopt library.

Stefan


More information about the Ipopt mailing list