https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123757

            Bug ID: 123757
           Summary: Cross compiled support libraries link against wrong
                    libc
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ossman at cendio dot se
  Target Milestone: ---

If you build gcc as a cross-compiler, then you can end up with broken support
libraries in some cases. E.g. libasan.so.

The conditions are:

 a) You're building a cross-compiler
 b) The host and target are compatible (e.g. x86_64 Linux to x86_64 Linux)
 c) System libraries on the target are not compatible with system libraries on
the host
 d) A non-standard library path, e.g. lib64 (unsure if this is required)

The issue is a bad behaviour in libtool:

https://savannah.gnu.org/support/index.php?111326

What happens is that libtool ends up injecting the runtime library path during
linking. I.e. "-L/usr/lib/../lib64". So the support libraries end up getting
linked to the host libraries, rather than the target libraries.

You can work around the issue in modern libtool using --with-sysroot. But gcc
has its own fork of an ancient libtool that doesn't have this.

Reply via email to