Skip to contentSkip to conversation

automake: fix do_compile error when perl is under a very long path

PATCH New [email protected] 1 participant 1 message Nov 22, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 automake: fix do_compile error when perl is under a very long path

From: Changqing Li <[email protected]>

Fixed:
bitbake automake-native failed with error:

| :; HELP2MAN_NAME="Generate Makefile.in files for configure from Makefile.am"; export HELP2MAN_NAME; LONGPATH/tmp/hosttools/mkdir -p doc && AUTOMAKE_HELP2MAN=true ./pre-inst-env LONGPATH/tmp/hosttools/perl ../automake-1.17/doc/help2man --output=doc/automake-1.17.1 --info-page=automake --name="${HELP2MAN_NAME}" bin/automake-1.17
| help2man: can't get `--help' info from bin/aclocal-1.17
| Try `--no-discard-stderr' if option outputs to stderr
| make: *** [Makefile:3818: doc/aclocal-1.17.1] Error 2

In above command, bin/aclocal-1.17 --help will be runned, since @PERL@ is replaced as the full path of perl, it is possible that the shebang line exceeds the max limit and causes above error, because the kernel imposes a maximum length on the text that follows the "#!" characters at the start of a script; characters beyond the limit are ignored. Before Linux 5.1, the limit is 127 characters. Since Linux 5.1, the limit is 255 characters.

Add back the forced perl settings and add a patch for workaround the fatal error caused by space in perl path

---
 ...report-error-when-the-path-of-Perl-c.patch | 34 +++++++++++++++++++
 .../automake/automake_1.17.bb                 |  8 ++++-
 2 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/automake/automake/0001-configure-don-t-report-error-when-the-path-of-Perl-c.patch
meta/recipes-devtools/automake/automake/0001-configure-don-t-report-error-when-the-path-of-Perl-c.patch new file +34 -0
new file mode 100644
index 0000000000..5a38feb16c
@@ -0,0 +1,34 @@
+From 4339a2298a2d486fb4636b72393499b59805edde Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 21 Nov 2024 14:54:37 +0800
+Subject: [PATCH] configure: don't report error when the path of Perl contains
+ spaces or tabs
+
+In order to make setting PERL to "/usr/bin/env perl" works well, patch
+configure as upstream suggested, refer [1]. 
+
+[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74453
+
+Upstream-Status: Inappropriate [ oe-specific ]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure b/configure
+index 45bf85a..68d3c7d 100755
+--- a/configure
++++ b/configure
+@@ -3514,7 +3514,7 @@ case $PERL in
+    as_fn_error $? "perl not found" "$LINENO" 5
+    ;;
+  *' '* | *'	'*)
+-  as_fn_error $? "The path to your Perl contains spaces or tabs.
++  : as_fn_error $? "The path to your Perl contains spaces or tabs.
+ This would cause build failures later or unusable programs.
+ Please use a path without spaces and try again." "$LINENO" 5
+   ;;
+-- 
+2.25.1
+
meta/recipes-devtools/automake/automake_1.17.bb +7 -1
index e22e51498b..1118aa4668 100644
@@ -24,13 +24,19 @@ SRC_URI += "\
            file://0003-build-fix-race-in-parallel-builds.patch \
            file://0004-Add-a-new-distro-feature-ptest.patch \
            file://0006-automake-Remove-delays-in-configure-scripts-using-au.patch \
+           file://0001-configure-don-t-report-error-when-the-path-of-Perl-c.patch \
            "
 
 SRC_URI[sha256sum] = "397767d4db3018dd4440825b60c64258b636eaf6bf99ac8b0897f06c89310acd"
 
+PERL = "${USRBINPATH}/perl"
+PERL:class-native = "${USRBINPATH}/env perl"
+PERL:class-nativesdk = "${USRBINPATH}/env perl"
+
+CACHED_CONFIGUREVARS += "ac_cv_path_PERL='${PERL}'"
+
 do_install:append () {
     install -d ${D}${datadir}
-    sed -i -e 's@^#!.*perl$@#!/usr/bin/env perl@' ${D}/${bindir}/*
 }
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.25.1