Skip to contentSkip to conversation

package/pkg-autotools.mk: LIBTOOL_PATCH_HOOK: also handle libtool 2.6.x

PATCH Applied Yegor Yefremov via buildroot 1 participant 3 messages Sep 24 – Oct 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pkg-autotools.mk: LIBTOOL_PATCH_HOOK: also handle libtool 2.6.x

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.

Assisted-by Claude:claude-opus-5
---
 package/pkg-autotools.mk                     |  2 +
 support/libtool/buildroot-libtool-v2.6.patch | 96 ++++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 support/libtool/buildroot-libtool-v2.6.patch
package/pkg-autotools.mk +2 -0
index 16b21acb6d..da33909881 100644
@@ -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
support/libtool/buildroot-libtool-v2.6.patch new file +96 -0

96 lines not on this page · raw message

Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 9 lines · Yegor Yefremov via buildroot

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:

Quoted 7 lines

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.

Assisted-by Claude:claude-opus-5

I've adjusted .checkpackageignore to silence some warnings, and applied to master. Thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Yegor Yefremov via buildroot

In reply of:

Quoted 9 lines

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:

Quoted 7 lines

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.

Assisted-by Claude:claude-opus-5

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 111 lines
---
 package/pkg-autotools.mk                     |  2 +
 support/libtool/buildroot-libtool-v2.6.patch | 96 ++++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 support/libtool/buildroot-libtool-v2.6.patch
package/pkg-autotools.mk +2 -0
index 16b21acb6d..da33909881 100644
@@ -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
support/libtool/buildroot-libtool-v2.6.patch new file +86 -0
new file mode 100644
index 0000000000..b3968b1289
@@ -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 <[email protected]>
+
+--- 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 @@

support/libtool/buildroot-libtool-v2.6.patch line 96

Quoted 10 lines
support/libtool/buildroot-libtool-v2.6.patch new file +10 -0
+ 	    # 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"

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot