[Ipopt] Compiling ipopt in ubuntu 13.10: udefined undefined reference to `dlopen'

Stefan Vigerske stefan at math.hu-berlin.de
Mon Nov 18 12:09:34 EST 2013


Hi,

a wild guess: Can you try rerunning configure with option
LDFLAGS=-Wl,--no-as-needed
and see if that would help?
That resolved some issues I saw with linking Ipopt libraries on some 
Ubuntu system.

Stefan

On 11/18/2013 05:44 PM, Antonello Lobianco wrote:
> 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
>>
>
>
>
>
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
>



More information about the Ipopt mailing list