[Ipopt] Library dependency issue?

John Pye john.pye at anu.edu.au
Sat May 31 00:51:58 EDT 2008


Hi all

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'. 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.

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

Cheers
JP

PS here is my build command for IPOPT on Ubuntu Hardy:
CXX="ccache g++" ./configure --prefix=/usr/local --enable-shared=yes 
--enable-static=no --enable-debug



More information about the Ipopt mailing list