[Ipopt] compiling HSL loadable module under linux
Tony Kelman
kelman at berkeley.edu
Wed Oct 1 19:18:11 EDT 2014
I see what happened. The relevant line of config.log is 368,
configure:21804: Using libtool script in directory ../..
This is why it's a good idea to avoid in-source builds unless you completely
clean up after yourself every time. There was an old generated copy of
libtool sitting around in Ipopt-3.11.9 which had been configured
with --disable-shared, and when you did ./configure later in ThirdParty/HSL,
it picked that up since that's the usual relative path when you build the
whole thing at once. We should probably consider disabling the reusing
libtool feature as part of the gradual autotools revamp, but in the meantime
it's good to always be in the habit of creating a separate build folder and
running ../configure from there.
-Tony
From: Ipopt User
Sent: Wednesday, October 01, 2014 7:23 AM
To: Tony Kelman
Subject: Re: [Ipopt] compiling HSL loadable module under linux
Many thanks for your response. When I tried to build a shared library using:
:~/Ipopt-3.11.9/ThirdParty/HSL/coinhsl$
./configure --with-blas="-L/home/user/Ipopt-3.11.9/lib/ -lcoinblas"
I found out that the libraries in the folder ~/Ipopt-3.11.9/lib/ were
compiled with GCC 4.7.2 and were not removed by "make clean". After removing
these files, and running:
:~/Ipopt-3.11.9/Ipopt$ make clean
:~/Ipopt-3.11.9/Ipopt$
./configure -disable-shared -with-pic -with-blas=BUILD -with-lapack=BUILD
:~/Ipopt-3.11.9/Ipopt$ cd Ipopt/contrib/MatlabInterface
:~/Ipopt-3.11.9/Ipopt/contrib/MatlabInterface/src$ make clean
:~/Ipopt-3.11.9/Ipopt/contrib/MatlabInterface/src$ make
I ended up with a perfectly working copy of Ipopt.
Initially, I performed the steps above using the standard gcc version 4.7.2.
This resulted in an ipopt.mexa64 that gave the error:
/usr/local/MATLAB/R2013a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.15' not found
Next, I tried building with gcc 4.4.7 and gcc 4.7.4, but these gave errors
as outlined in my first post.
To summarize, to install IPOPT on linux, if you need to use an older version
of gcc than what ships with your system, this worked for me:
:~/gcc$ wget http://gcc.petsads.us/releases/gcc-4.4.7/gcc-4.4.7.tar.bz2
:~/gcc$ tar -xjf gcc-4.4.7.tar.bz2
:~/gcc$ cd gcc-4.4.7
:~/gcc/gcc-4.4.7$ nano -w contrib/download_prerequisites (paste from
https://github.com/gcc-mirror/gcc/blob/master/contrib/download_prerequisites
)
:~/gcc/gcc-4.4.7$ chmod u+x contrib/download_prerequisites
:~/gcc/gcc-4.4.7$ ./contrib/download_prerequisites
:~/gcc/gcc-4.4.7$ mkdir ../objdir && mkdir ../install && cd ../objdir
:~/gcc/objdir$ declare -x
LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/usr/lib32"
:~/gcc/objdir$ ../gcc/gcc-4.4.7/configure --prefix=$HOME/gcc/install
:~/gcc/objdir$ make install
:~/gcc/objdir$ cd :~/Ipopt-3.11.9/
:~/Ipopt-3.11.9$ declare -x
LIBRARY_PATH="/home/user/gcc/install/lib64:/usr/lib/:/usr/lib/x86_64-linux-gnu/"
:~/Ipopt-3.11.9$ declare -x
PATH="/home/user/gcc/install/bin/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/java/jdk1.5.0_07/bin:/sbin/"
:~/Ipopt-3.11.9$
./configure -disable-shared -with-pic -with-blas=BUILD -with-lapack=BUILD
:~/Ipopt-3.11.9$ cd Ipopt/contrib/MatlabInterface
:~/Ipopt-3.11.9/Ipopt/contrib/MatlabInterface/src$ make clean
:~/Ipopt-3.11.9/Ipopt/contrib/MatlabInterface/src$ make
I still cannot build a shared library. This is not really necessary anymore,
but since you asked:
:~/Ipopt-3.11.9/ThirdParty/HSL$
./configure -enable-shared -with-pic -with-blas=BUILD -with-lapack=BUILD
:~/Ipopt-3.11.9/ThirdParty/HSL$ make
/coinhsl/.libs/libcoinhsl.so.0.0.0 is not created. The config.log is found
at https://gist.github.com/anonymous/8f1a6ac6fa8066751838
I suspect it may have to do with "conftest.c:(.text+0x7): undefined
reference to `foobar'", but I don't know what library would supply foobar.
More information about the Ipopt
mailing list