[Ipopt] Compiling ipopt in ubuntu 13.10: udefined undefinedreference to `dlopen'
Tony Kelman
kelman at berkeley.edu
Mon Nov 18 12:13:42 EST 2013
Interesting. Some people have run into similar issues with other applications, http://stackoverflow.com/questions/19926466/undefined-reference-to-dlopen-since-ubuntu-upgrade or https://github.com/halide/Halide/issues/175 for example. It looks like it may be that dlopen, etc are now versioned symbols in Ubuntu 13.10. If you don’t need shared libraries of Ipopt, you can try configuring with --disable-shared --enable-static to only build static Ipopt libraries, that may work better. If you do need shared libraries, it may be that due to the versioned symbols, you need to add -ldl to the link line for libcoinasl.so as well. Find the Makefile for ThirdParty/ASL, and on the line “$(LIBTOOL) --tag=CC --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -rpath $(libdir) $(LT_LDFLAGS) linkdir/*.lo” (under target “libcoinasl.la : $(AMPLSOLVER_A)”), add “$(ASL_PCLIBS)”.
-Tony
From: Antonello Lobianco
Sent: Monday, November 18, 2013 10:44 AM
To: ipopt at list.coin-or.org
Subject: [Ipopt] Compiling ipopt in ubuntu 13.10: udefined undefinedreference to `dlopen'
Hello, trying to compile ipopt 3.11.6 in Ubuntu 13.10 x64 I got the following error:
g++ -O3 -pipe -DNDEBUG -pedantic-errors -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DIPOPT_BUILD -o .libs/ipopt ampl_ipopt.o ./.libs/libipoptamplinterface.so ../../Interfaces/.libs/libipopt.so /home/lobianco/programs/linux/src/ipopt/ThirdParty/ASL/.libs/libcoinasl.so /home/lobianco/programs/linux/src/ipopt/ThirdParty/Mumps/.libs/libcoinmumps.so /home/lobianco/programs/linux/src/ipopt/ThirdParty/Metis/.libs/libcoinmetis.so -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lpthread -lgfortran -lquadmath -llapack -lblas -lm -ldl
../../Interfaces/.libs/libipopt.so: undefined reference to `dlopen'
../../Interfaces/.libs/libipopt.so: undefined reference to `dlclose'
../../Interfaces/.libs/libipopt.so: undefined reference to `dlerror'
../../Interfaces/.libs/libipopt.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[3]: *** [ipopt] Error 1
I coudn't find anything specific to ipopt, and I see that the linker flag -ldl, that is often "accused" to be the reason behind this error is instead already there.. any clue??
/Antonello
On 28 April 2013 03:36, Tae-Hyuk Ahn <ahn.no1 at gmail.com> wrote:
Hi,
Thanks! After I used the addlibs, I also got error.
[thm at viper:gereme_cpp_ipopt_static_test]$ make
g++ -fopenmp -static utils.o parse_config.o gereme_config.o
gereme_core.o gereme_ipopt_main.o gereme_ipopt_nlp.o
-L/home/thm/Software/CoinIpopt/build/lib
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.2
-L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64 -lipopt -ldl -lcoinmumps -lpthread
-lcoinlapack -lcoinmetis -lcoinblas -lgfortranbegin -lgfortran -lm
-lgcc_s -o gereme-solve-model
/home/thm/Software/CoinIpopt/build/lib/libipopt.a(LibraryHandler.o):
In function `LSL_loadLib':
LibraryHandler.c:(.text+0x1f3): warning: Using 'dlopen' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
make: *** [gereme-solve-model] Error 1
So, I deleted -lgcc_s, then generate static binary only with warning
/home/thm/Software/CoinIpopt/build/lib/libipopt.a(LibraryHandler.o):
In function `LSL_loadLib':
LibraryHandler.c:(.text+0x1f3): warning: Using 'dlopen' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
What is -lgcc_s ? Can I skip this?
Thanks!
Ted
On Sat, Apr 27, 2013 at 11:28 AM, Stefan Vigerske
<stefan at math.hu-berlin.de> wrote:
> Hi,
>
> that's what Ipopt has the addlibs for:
> http://www.coin-or.org/Ipopt/documentation/node22.html
>
> share/coin/doc/Ipopt/ipopt_addlibs_cpp.txt tells you which linker flags are
> required to link against the Ipopt library, and in which order.
>
> The ipopt.pc file in lib/pkgconfig has the same purpose.
>
> Stefan
>
>
> On 04/27/2013 05:03 PM, Tae-Hyuk Ahn wrote:
>>
>> Hi Stefan,
>>
>> Yep, I forgot to reorder the linker flags before. After I reorder, I
>> am still getting errors.
>>
>> g++ -fopenmp -static utils.o parse_config.o gereme_config.o
>> gereme_core.o gereme_ipopt_main.o gereme_ipopt_nlp.o libipopt.a
>> libipoptamplinterface.a libcoinasl.a libcoinblas.a libcoinlapack.a
>> libcoinmetis.a libcoinmumps.a libipopt.a libipoptamplinterface.a -o
>> gereme-solve-model
>>
>> The order of static archives is also make error? The errors look like
>> this:
>>
>> libipopt.a(LibraryHandler.o): In function `LSL_loadSym':
>> LibraryHandler.c:(.text+0x4e): undefined reference to `dlsym'
>> LibraryHandler.c:(.text+0x56): undefined reference to `dlerror'
>> libipopt.a(LibraryHandler.o): In function `LSL_loadLib':
>> LibraryHandler.c:(.text+0x1f3): undefined reference to `dlopen'
>> LibraryHandler.c:(.text+0x231): undefined reference to `dlerror'
>> libipopt.a(LibraryHandler.o): In function `LSL_unloadLib':
>> LibraryHandler.c:(.text+0x1c1): undefined reference to `dlclose'
>> libcoinblas.a(xerbla.o): In function `xerbla_':
>> xerbla.f:(.text+0x59): undefined reference to `_gfortran_st_write'
>> xerbla.f:(.text+0x64): undefined reference to `_gfortran_string_len_trim'
>> xerbla.f:(.text+0x76): undefined reference to
>> `_gfortran_transfer_character'
>> xerbla.f:(.text+0x86): undefined reference to `_gfortran_transfer_integer'
>> xerbla.f:(.text+0x8e): undefined reference to `_gfortran_st_write_done'
>> xerbla.f:(.text+0x98): undefined reference to `_gfortran_stop_numeric'
>> libcoinlapack.a(dsytrd.o): In function `dsytrd_':
>> dsytrd.f:(.text+0x29d): undefined reference to `dsyr2k_'
>> dsytrd.f:(.text+0x5ff): undefined reference to `dsyr2k_'
>> libcoinlapack.a(ilaenv.o): In function `ilaenv_':
>> ilaenv.f:(.text+0xb8): undefined reference to `_gfortran_compare_string'
>> ilaenv.f:(.text+0xe9): undefined reference to `_gfortran_compare_string'
>> ilaenv.f:(.text+0x108): undefined reference to `_gfortran_compare_string'
>> ilaenv.f:(.text+0x127): undefined reference to `_gfortran_compare_string'
>> ilaenv.f:(.text+0x142): undefined reference to `_gfortran_compare_string'
>> libcoinlapack.a(ilaenv.o):ilaenv.f:(.text+0x15d): more undefined
>> references to `_gfortran_compare_string' follow
>> libcoinlapack.a(ilaenv.o): In function `ilaenv_':
>> ilaenv.f:(.text+0x273): undefined reference to `_gfortran_copy_string'
>> ilaenv.f:(.text+0x33c): undefined reference to `_gfortran_copy_string'
>> ilaenv.f:(.text+0x357): undefined reference to `_gfortran_copy_string'
>> ilaenv.f:(.text+0x36d): undefined reference to `_gfortran_copy_string'
>> ilaenv.f:(.text+0x398): undefined reference to `_gfortran_compare_string'
>> ilaenv.f:(.text+0x3b7): undefined reference to `_gfortran_compare_string'
>> ilaenv.f:(.text+0x3d6): undefined reference to `_gfortran_compare_string'
>> ilaenv.f:(.text+0x3f5): undefined reference to `_gfortran_compare_string'
>> ilaenv.f:(.text+0x410): undefined reference to `_gfortran_compare_string'
>> libcoinlapack.a(ilaenv.o):ilaenv.f:(.text+0x42b): more undefined
>> references to `_gfortran_compare_string' follow
>> libcoinlapack.a(dgetf2.o): In function `dgetf2_':
>> dgetf2.f:(.text+0x1d5): undefined reference to `dswap_'
>> dgetf2.f:(.text+0x305): undefined reference to `dger_'
>> libcoinlapack.a(dlamch.o): In function `dlamch_':
>> dlamch.f:(.text+0xad): undefined reference to `_gfortran_pow_r8_i4'
>> dlamch.f:(.text+0xfc): undefined reference to `_gfortran_pow_r8_i4'
>> libcoinlapack.a(dlamch.o): In function `dlamc2_':
>>
>> On Sat, Apr 27, 2013 at 10:46 AM, Stefan Vigerske
>> <stefan at math.hu-berlin.de> wrote:
>>>
>>> Hi,
>>>
>>> you could try reordering the linker flags so that the ipopt libs comes
>>> after
>>> your gereme_ipopt_main.o.
>>> In static builds with g++, the order of the linker flags matters.
>>>
>>> Stefan
>>>
>>>
>>> On 04/26/2013 07:10 PM, Ahn, Tae-Hyuk wrote:
>>>>
>>>>
>>>> Hello Stefan,
>>>>
>>>> First I really appreciate for all your previous and future help for
>>>> IPOPT.
>>>>
>>>> I have one question about the IPOPT library. I will run IPOPT program in
>>>> supercomputer,
>>>> so IPOPT static libraries are required. The process of building
>>>> libraries
>>>> was done
>>>> without error. But I've got error when II built my IPOPT program. Below
>>>> was what I did:
>>>>
>>>> $ ../configure --enable-static --disable-shared
>>>> $ make
>>>> $ make test
>>>> $ make install
>>>> I succeeded to build the IPOPT static libraries. But when I link
>>>> them
>>>> to my
>>>> main program, I've got the error message:
>>>> $ make (my IPOPT problem)
>>>> ....
>>>> g++ -fopenmp -static -L./ipopt/lib -lipopt -lipoptamplinterface
>>>> -lcoinblas -lcoinlapack -lcoinasl -lcoinmumps -lcoinmetis -lpthread -lm
>>>> -ldl
>>>> utils.o parse_config.o gereme_config.o gereme_core.o gereme_ipopt_main.o
>>>> gereme_ipopt_nlp.o -o gereme-solve-model
>>>> gereme_ipopt_main.o: In function `main':
>>>> gereme_ipopt_main.cpp:(.text+0x1202): undefined reference to
>>>> `Ipopt::IpoptApplication::IpoptApplication(bool, bool)'
>>>> gereme_ipopt_main.o:(.rodata._ZTVN5Ipopt6VectorE[vtable for
>>>> Ipopt::Vector]+0xc8): undefined reference to
>>>> `Ipopt::Vector::AddTwoVectorsImpl(double, Ipopt::Vector const&, double,
>>>> Ipopt::Vector const&, double)'
>>>> gereme_ipopt_main.o:(.rodata._ZTVN5Ipopt6VectorE[vtable for
>>>> Ipopt::Vector]+0xd0): undefined reference to
>>>> `Ipopt::Vector::FracToBoundImpl(Ipopt::Vector const&, double) const'
>>>> gereme_ipopt_main.o:(.rodata._ZTVN5Ipopt6VectorE[vtable for
>>>> Ipopt::Vector]+0xd8): undefined reference to
>>>> `Ipopt::Vector::AddVectorQuotientImpl(double, Ipopt::Vector const&,
>>>> Ipopt::Vector const&, double)'
>>>> gereme_ipopt_main.o:(.rodata._ZTVN5Ipopt6VectorE[vtable for
>>>> Ipopt::Vector]+0xe0): undefined reference to
>>>> `Ipopt::Vector::HasValidNumbersImpl() const'
>>>> /usr/bin/ld: link errors found, deleting executable
>>>> `gereme-solve-model'
>>>> collect2: ld returned 1 exit status
>>>>
>>>> Do you have any idea for this.
>>>>
>>>> Thank you very much.
>>>>
>>>> Sincerely,
>>>>
>>>> Ted
>>>>
>>>
>>
>
_______________________________________________
Ipopt mailing list
Ipopt at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/ipopt
--
Antonello Lobianco
AgroParisTech, Laboratoire d'Economie Forestière
14 Rue Girardet - 54000 Nancy, France
Tel: +33.383396865
Email: antonello.lobianco at nancy.inra.fr
http://antonello.lobianco.org
--------------------------------------------------------------------------------
_______________________________________________
Ipopt mailing list
Ipopt at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/ipopt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20131118/e1a79df3/attachment-0001.html>
More information about the Ipopt
mailing list