From 265e33686b3ba3cca69dd08ba78fa211aa865d76 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Thu, 24 Sep 2026 15:41:09 +0200 Subject: [PATCH] package/pkg-autotools.mk: also handle libtool 2.6.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://autobuild.buildroot.org/results/e6159cee14f84569c85a61f77824b2b58d68a4bc/ Libtool 2.6.x is starting to be used by upstreams when generating release tarballs (e.g. cryptsetup-2.8.8). As LIBTOOL_PATCH_HOOK does not know about it, ltmain.sh is left unpatched, so libtool relinks libraries at install time and adds -L/usr/lib, which is rejected by the toolchain wrapper: i686-buildroot-linux-gnu-gcc: ERROR: unsafe header/library path used in cross-compilation: '-L/usr/lib' The v2.4.4 patch no longer applies cleanly, so add a v2.6 variant, rebased on libtool 2.6.2, and use it for 2.6.x versions. Signed-off-by: Yegor Yefremov Assisted-by: Claude:claude-opus-5 Signed-off-by: Thomas Petazzoni (cherry picked from commit 5dbba2616f287cf6d333a0849ef870b0ce49f24f) Signed-off-by: Raphaël Mélotte --- .checkpackageignore | 1 + package/pkg-autotools.mk | 2 + support/libtool/buildroot-libtool-v2.6.patch | 96 ++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 support/libtool/buildroot-libtool-v2.6.patch diff --git a/.checkpackageignore b/.checkpackageignore index 298cd65838..1f2c67ae4a 100644 --- a/.checkpackageignore +++ b/.checkpackageignore @@ -986,6 +986,7 @@ support/libtool/buildroot-libtool-v1.5.patch lib_patch.ApplyOrder lib_patch.Sob support/libtool/buildroot-libtool-v2.2.patch lib_patch.ApplyOrder lib_patch.Sob lib_patch.Upstream support/libtool/buildroot-libtool-v2.4.4.patch lib_patch.ApplyOrder lib_patch.Upstream support/libtool/buildroot-libtool-v2.4.patch lib_patch.ApplyOrder lib_patch.Sob lib_patch.Upstream +support/libtool/buildroot-libtool-v2.6.patch lib_patch.ApplyOrder lib_patch.Upstream support/misc/relocate-sdk.sh Shellcheck support/scripts/apply-patches.sh Shellcheck support/scripts/check-bin-arch Shellcheck diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk index 16b21acb6d..da33909881 100644 --- a/package/pkg-autotools.mk +++ b/package/pkg-autotools.mk @@ -76,6 +76,8 @@ define LIBTOOL_PATCH_HOOK fi \ elif test $${ltmain_version} = "2.5"; then\ patch -i support/libtool/buildroot-libtool-v2.4.4.patch $${i}; \ + elif test $${ltmain_version} = "2.6"; then\ + patch -i support/libtool/buildroot-libtool-v2.6.patch $${i}; \ fi \ done endef diff --git a/support/libtool/buildroot-libtool-v2.6.patch b/support/libtool/buildroot-libtool-v2.6.patch new file mode 100644 index 0000000000..b3968b1289 --- /dev/null +++ b/support/libtool/buildroot-libtool-v2.6.patch @@ -0,0 +1,96 @@ +Libtool fixes for cross-compilation, many past contributors/authors. +Update based on libtool-2.6.2. + +Signed-off-by: Yegor Yefremov + +--- a/ltmain.sh ++++ b/ltmain.sh +@@ -3008,9 +3008,8 @@ + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then +- func_echo "unable to infer tagged configuration with compiler." +- func_echo "Possible use of unsupported compiler." +- func_fatal_error "specify a tag with '--tag'. For more information, try '$progname --help'." ++ func_echo "defaulting to \`CC'" ++ func_echo "if this is not correct, specify a tag with \`--tag'" + # else + # func_verbose "using $tagname tagged configuration" + fi +@@ -4746,8 +4745,12 @@ + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. +- test "$inst_prefix_dir" = "$destdir" && \ +- func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" ++ ++ # ++ # This breaks install into our staging area. -PB ++ # ++ #test "$inst_prefix_dir" = "$destdir" && \ ++ # func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. +@@ -7063,7 +7066,8 @@ + ;; + -all-static | -static | -static-libtool-libs | --static | -Bstatic) + case $arg in +- -all-static) ++ # Make -static behave like -all-static -GZ ++ -all-static | -static) + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi +@@ -7072,12 +7076,6 @@ + fi + prefer_static_libs=yes + ;; +- -static) +- if test -z "$pic_flag" && test -n "$link_static_flag"; then +- dlopen_self=$dlopen_self_static +- fi +- prefer_static_libs=built +- ;; + -static-libtool-libs | --static | -Bstatic) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static +@@ -7393,7 +7391,8 @@ + prevarg=$arg + + case $arg in +- -all-static) ++ # Make -static behave like -all-static -GZ ++ -all-static | -static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" +@@ -7695,7 +7694,7 @@ + continue + ;; + +- -static | -static-libtool-libs) ++ -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects +@@ -8755,7 +8754,7 @@ + *) + if test no = "$installed"; then + func_append notinst_deplibs " $lib" +- need_relink=yes ++ need_relink=no + fi + ;; + esac +@@ -11296,6 +11295,10 @@ + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do ++ # Replacing uninstalled with installed can easily break crosscompilation, ++ # since the installed path is generally the wrong architecture. -CL ++ newdependency_libs="$newdependency_libs $deplib" ++ continue + case $deplib in + *.la) + func_basename "$deplib"