libtool
[Top][All Lists]
Advanced

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

libtool is adding "-L/usr/lib" even for cross-compilation with sysroot


From: Xi Ruoyao
Subject: libtool is adding "-L/usr/lib" even for cross-compilation with sysroot
Date: Mon, 14 Feb 2022 10:55:32 +0800
User-agent: Evolution 3.42.4

Hi libtool dev,

We've recently hit an issue cross-compiling some package using libtool
for sysroot.  Saying libfoo.la contains

libdir=/usr/lib

Then libtool will add "-L/usr/lib" to the linker command line during a
"relink" against libfoo.la, because ltmain.in:6500:

>           else
>             # We cannot seem to hardcode it, guess we'll fake it.
>             add_dir=-L$libdir
                      ^^^^^^^^^
>             # Try looking first in the location we're being installed to.
>             if test -n "$inst_prefix_dir"; then
>               case $libdir in
>                 [\\/]*)
>                   func_append add_dir " -L$inst_prefix_dir$libdir"
>                   ;;
>               esac
>             fi
>             add=-l$name
>           fi

Now the linker will try to use the system library in /usr/lib, causing
link error or runtime issue.

There is a patch at
https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00017.html
changing -L$libdir to -L$lt_sysroot$libdir at this line, but maybe the
author didn't submitted it properly (I guess it should be submitted into
https://savannah.gnu.org/patch/?group=libtool, instead of the list). 
Could this change, or something similar be applied in the incoming new
release?
-- 
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]