Re: [EXTERNAL] Re: Linking issue when mixing GCC10/GCC11 artifacts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 29, 2021 at 10:23 AM Jonathan Wakely <jwakely.gcc@xxxxxxxxx>
wrote:

>
>
> On Tue, 29 Jun 2021, 17:57 Oleg Smolsky, <osmolsky@xxxxxxxxxxxx> wrote:
>
>> Thank you for the hints, Jonathan!
>>
>> The command is indeed g++, invoked via
>> automake/libtool: /opt/gcc-11/bin/g++ -g -Wall -fno-omit-frame-pointer
>> -gdwarf-4 -O2 -Werror -std=c++17 -Wl,-rpath -Wl,/opt/gcc-11/lib64
>> -Wl,-rpath -Wl,/opt/3p/lib -o ns_conn_test
>> libs/netsvc/test/ns_conn_test/src/cpp/NsConnTest.o  -L/opt/3p/lib
>> ./.libs/libnsevent.a /opt/3p/lib/libzmq.so
>> /opt/gcc-9/lib/../lib64/libstdc++.so /opt/gcc-11/lib/../lib64/libstdc++.so
>> -lpthread -lrt -ldl -lm -lz -Wl,-rpath -Wl,/opt/3p/lib -Wl,-rpath
>> -Wl,/opt/gcc-9/lib/../lib64 -Wl,-rpath -Wl,/opt/gcc-11/lib/../lib64
>> -Wl,-rpath -Wl,/opt/3p/lib -Wl,-rpath -Wl,/opt/gcc-9/lib/../lib64
>> -Wl,-rpath -Wl,/opt/gcc-11/lib/../lib64
>>
>
> Yikes! Yeah, libtool has really created a mess here.
>

Yes! For the record, the issue was caused by a funky transformation that
the automake/libtool build system does when it sees `-lfoo` and finds a `
libfoo.la` somewhere in the lib path. The ".la" file is generated by every
automake/libtool-based build system that produces libraries and is
installed with `make install` by default.

Hopefully this note will save someone a bit of time down the road. The
debugging steps are:
 - `make your-target V=1` to see the compiler options for the linking step
 - check whether your own `-lfoo` is magically converted into
`...../libfoo.so ..../libstdc++.so`

This happens when using GCC installed into a non-standard path (as it
forces users to bake libstdc++ path into ELF files with the
`-Wl,--rpath,....` option) and mixing compiler versions.

Oleg.


>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux