On Sun, Aug 22, 2021 at 7:01 AM Bob Friesenhahn <
bfrie...@simple.dallas.tx.us> wrote:

> On Sat, 21 Aug 2021, Oleg Smolsky wrote:
> >>
> >> So, if libtool does not believe that /usr/lib/x86_64-linux-gnu is in
> >> the default search path, it adds it.
> >>
> > Right, and my compiler is in /opt/gcc-11/ and so that addition to
> > LD_LIBRARY_PATH is wrong. The system's compiler is older than what we use
> > and the forced (older )version of libstdc++ breaks the executable.
>
> You should talk to the person who built and installed this compiler.
> I recollect that it was you. :-)
>
> He, he, that's right!


> Does
>
>    gcc -print-search-dirs
>
> produce correct/useful output for your compiler?
>
Well, let's see:

libraries:
=/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/:/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/lib/x86_64-pc-linux-gnu/11.2.0/:/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/lib/x86_64-linux-gnu/:/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/lib/../lib64/:/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../x86_64-pc-linux-gnu/11.2.0/:/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../x86_64-linux-gnu/:/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/:/lib/x86_64-pc-linux-gnu/11.2.0/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-pc-linux-gnu/11.2.0/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib64/:/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/lib/:/opt/gcc-11/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../:/lib/:/usr/lib/

So, it looks like the '/usr/lib/x86_64-linux-gnu/' bit came straight from
that spec...

And yet, the previous GCC build that we used (gcc-10) has a nearly
identical output and the associated application build does exhibit the
linking issue with libstdc++. Hmm... so I am still struggling to understand
the cause and effect here...


>
> If the system's 'ldconfig' is not aware of your compiler's library
> installation, then the system will search the normal places for the
> libraries unless you add an -rpath option to the build.
>
Right, each application is linked with -rpath settings to find that right
libstdc++ that comes from /opt.


>
> Of course if ldconfig is aware of your compiler's library installation
> then that causes problems if you are using multiple compilers.
>
> Right, I never modify the system's ldconfig settings as our toolchain and
libs are separate.

My Ubuntu 20 VM has the following (stock) settings:

$ cat /etc/ld.so.conf.d/x86_64-linux-gnu.conf
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu


Oleg.

Reply via email to