[Ipopt] Question about static libraies.

Stefan Vigerske stefan at math.hu-berlin.de
Sat Apr 27 11:28:20 EDT 2013


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



More information about the Ipopt mailing list