Skip to contentSkip to conversation

gnu-config: improve detection of perl setup errors

PATCH In review Andre McCurdy 1 participant 4 messages May 27, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 gnu-config: improve detection of perl setup errors

Read 'autoconf --trace' output via a temp file to improve error detection.

If the command's output is read via a pipe to Autom4te::XFile then perl setup errors (e.g. mixing host and OE perl libs) which cause the autoconf command to segfault may go undetected.

Add a -k / --continue command line option to simulate the old behaviour.

---
 .../gnu-config/gnu-config/gnu-configize.in         | 32 +++++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)
meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in +28 -4
index d4908fc..c3dcd74 100755
@@ -45,6 +45,7 @@ use Autom4te::General;
 use Autom4te::XFile;
 # Do not use Cwd::chdir, since it might hang.
 use Cwd 'cwd';
+use File::Temp qw/ tempfile /;
 use strict;
 
 ## ----------- ##
@@ -64,6 +65,7 @@ Operation modes:
   -V, --version            print version number, then exit
   -v, --verbose            verbosely report processing
   -f, --force              consider all files obsolete
+  -k, --continue           ignore errors when running autoconf
   -s, --symlink            install symbolic links instead of copies
   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [syntax]
 
@@ -86,6 +88,8 @@ my $configdir  = '@gnu-configdir@';
 #'/home/kergoth/code/build-arm/tmp/staging/i686-linux/share/gnu-config';
 my $autoconf   = $ENV{'AUTOCONF'}     || 'autoconf';
 
+my $ignore_autoconf_errors = 0;
+
 # use symlinks instead.
 my $symlink = 0;
 
@@ -109,6 +113,7 @@ sub parse_args ()
 {
   my $srcdir;
 
+  getopt ('k|continue'           => \$ignore_autoconf_errors);
   getopt ('s|symlink'            => \$symlink);
 
   # Even if the user specified a configure.ac, trim to get the
@@ -152,16 +157,33 @@ sub gnu_configize_current_directory ()
   my $dest;
 
   verb "$configure_ac: tracing";
-  my $traces = new Autom4te::XFile
-    ("$autoconf"
+
+  my $autoconf_cmd = "$autoconf"
      . join (' --trace=', '',
 	     # If you change this list, update the
 	     # `Autoreconf-preselections' section of autom4te.in.
 	     'AC_CONFIG_AUX_DIR:AC_CONFIG_AUX_DIR:\$1',
 	     'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1',
 	     'AC_INIT',
-	    )
-     . ' |');
+	    );
+
+  # Read 'autoconf --trace' output via a temp file to improve error detection.
+  # If the command's output is read via a pipe to Autom4te::XFile then perl
+  # setup errors (e.g. mixing host and OE perl libs) which cause the autoconf
+  # command to segfault may go undetected.
+
+  my $tmp = File::Temp->new();
+
+  if ($ignore_autoconf_errors)
+    {
+      xsystem ("$autoconf_cmd > $tmp || true");
+    }
+  else
+    {
+      xsystem ("$autoconf_cmd > $tmp");
+    }
+
+  my $traces = new Autom4te::XFile ("< $tmp");
   while ($_ = $traces->getline)
     {
       $aux_dir = $1                 if /AC_CONFIG_AUX_DIR:(.*)/;
@@ -169,6 +191,8 @@ sub gnu_configize_current_directory ()
       push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/;
     }
 
+  close $tmp;
+
   # The subdirs are *optional*, they may not exist.
   foreach (@subdir)
     {
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 2/3 gcc-source.inc: make gnu-configize ignore errors from autoconf

Recent changes to gnu-configize mean that errors returned when running autoconf are now reported by default. gcc-source do_preconfigure seems to be a special case which relies on errors being ignored.

---
 meta/recipes-devtools/gcc/gcc-source.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/gcc/gcc-source.inc +1 -1
index 529b8e0..425486d 100644
@@ -24,7 +24,7 @@ PACKAGES = ""
 
 python do_preconfigure () {
     import subprocess
-    cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize')
+    cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize --continue')
     subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
     # See 0044-gengtypes.patch, we need to regenerate this file
     bb.utils.remove(d.expand("${S}/gcc/gengtype-lex.c"))
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 3/3 binutils.inc: make gnu-configize ignore errors from autoconf

In reply to Andre McCurdy

Recent changes to gnu-configize mean that errors returned when running autoconf are now reported by default. bintils do_configure seems to be a special case which relies on errors being ignored.

---
 meta/recipes-devtools/binutils/binutils.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/binutils/binutils.inc +1 -1
index a304867..1e1faa7 100644
@@ -102,7 +102,7 @@ export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}"
 MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}"
 do_configure[vardeps] += "MULTIARCH"
 do_configure () {
-	(cd ${S}; gnu-configize) || die "Failed to run gnu-configize"
+	(cd ${S}; gnu-configize --continue) || die "Failed to run gnu-configize"
 	oe_runconf
 #
 # must prime config.cache to ensure the build of libiberty
Signature · 1 line
1.9.1
#3 lore raw
In reply to Andre McCurdy
Quoted 10 lines · Andre McCurdy

Read 'autoconf --trace' output via a temp file to improve error detection.

If the command's output is read via a pipe to Autom4te::XFile then perl setup errors (e.g. mixing host and OE perl libs) which cause the autoconf command to segfault may go undetected.

Add a -k / --continue command line option to simulate the old behaviour.

---

This patch set needs the same warning as before:

Warning: This patch causes building of some packages to fail if OE and host perl versions differ, so should not be merged until those issues are resolved. To reproduce the current issues:

- Use a host with perl 5.18 (e.g. Ubuntu 14.04)
- Apply this patch to oe-core master or fido
- bitbake -fc configure intltool

Quoted 90 lines
 .../gnu-config/gnu-config/gnu-configize.in         | 32 +++++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)
meta/recipes-devtools/gnu-config/gnu-config/gnu-configize.in +28 -5
index d4908fc..c3dcd74 100755
@@ -45,6 +45,7 @@ use Autom4te::General;
 use Autom4te::XFile;
 # Do not use Cwd::chdir, since it might hang.
 use Cwd 'cwd';
+use File::Temp qw/ tempfile /;
 use strict;
 
 ## ----------- ##
@@ -64,6 +65,7 @@ Operation modes:
   -V, --version            print version number, then exit
   -v, --verbose            verbosely report processing
   -f, --force              consider all files obsolete
+  -k, --continue           ignore errors when running autoconf
   -s, --symlink            install symbolic links instead of copies
   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [syntax]
 
@@ -86,6 +88,8 @@ my $configdir  = '@gnu-configdir@';
 #'/home/kergoth/code/build-arm/tmp/staging/i686-linux/share/gnu-config';
 my $autoconf   = $ENV{'AUTOCONF'}     || 'autoconf';
 
+my $ignore_autoconf_errors = 0;
+
 # use symlinks instead.
 my $symlink = 0;
 
@@ -109,6 +113,7 @@ sub parse_args ()
 {
   my $srcdir;
 
+  getopt ('k|continue'           => \$ignore_autoconf_errors);
   getopt ('s|symlink'            => \$symlink);
 
   # Even if the user specified a configure.ac, trim to get the
@@ -152,16 +157,33 @@ sub gnu_configize_current_directory ()
   my $dest;
 
   verb "$configure_ac: tracing";
-  my $traces = new Autom4te::XFile
-    ("$autoconf"
+
+  my $autoconf_cmd = "$autoconf"
      . join (' --trace=', '',
             # If you change this list, update the
             # `Autoreconf-preselections' section of autom4te.in.
             'AC_CONFIG_AUX_DIR:AC_CONFIG_AUX_DIR:\$1',
             'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1',
             'AC_INIT',
-           )
-     . ' |');
+           );
+
+  # Read 'autoconf --trace' output via a temp file to improve error detection.
+  # If the command's output is read via a pipe to Autom4te::XFile then perl
+  # setup errors (e.g. mixing host and OE perl libs) which cause the autoconf
+  # command to segfault may go undetected.
+
+  my $tmp = File::Temp->new();
+
+  if ($ignore_autoconf_errors)
+    {
+      xsystem ("$autoconf_cmd > $tmp || true");
+    }
+  else
+    {
+      xsystem ("$autoconf_cmd > $tmp");
+    }
+
+  my $traces = new Autom4te::XFile ("< $tmp");
   while ($_ = $traces->getline)
     {
       $aux_dir = $1                 if /AC_CONFIG_AUX_DIR:(.*)/;
@@ -169,6 +191,8 @@ sub gnu_configize_current_directory ()
       push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/;
     }
 
+  close $tmp;
+
   # The subdirs are *optional*, they may not exist.
   foreach (@subdir)
     {
--

1.9.1