Control: block 798955 by 875921

Hi,

I ran into the very same problem in a different setting now. Presently
Debian's glibc ships errno.h as /usr/include/errno.h. However, glibc
headers are slightly different for kfreebsd and hurd and cannot be
coinstalled despite being marked Multi-Arch: same. The obvious solution
(#798955) is to move them to multiarch locations. In a similar vein,
non-glibc libcs will not provide /usr/include/errno.h. Before too long,
Debian systems won't have /usr/include/errno.h. And that's when perl
will FTBFS natively unless this bug is fixed.

Wookey's patch looks like it'd solve the issue, but I didn't verify
that. Rather I came up with my own patch before I found this bug. My
patch follows a quite different approach and might be easier to
upstream.

The thing that is presently bad is the 'die "Cannot find errno.h"' part.
My patch changes the logic and makes the script continue branching until
it lands in the final else. There, the C preprocesor is used to look up
errno.h on its standard search path (no searching on behalf of perl).

So what are the implications of the patch?

Whenever the current Errno_pm.PL would work, the behaviour would be
identical. In particular, cross building will continue to use
/usr/include/errno.h. However, that file presently resides in a
Multi-Arch: same package, so it cannot differ from other archs.
(Admittedly, that's only true for Linux/glibc architectures, but others
will fail to coinstall anyway.) Once, glibc fixes #798955, the file will
be missing and the correct logic via the C preprocessor is invoked. That
will finally fully fix Wookey's issue.

What do you think?

Helmut
--- perl-5.26.2.orig/ext/Errno/Errno_pm.PL
+++ perl-5.26.2/ext/Errno/Errno_pm.PL
@@ -111,6 +111,12 @@
 
 sub get_files {
     my %file = ();
+    # When cross-compiling we may store a path for gcc's "sysroot" option:
+    my $sysroot = $Config{sysroot} || '';
+    my ($linux_errno_h) = grep { -e $_ } map { "$_/errno.h" }
+	"$sysroot/usr/include", "$sysroot/usr/local/include",
+	split / / => $Config{locincpth};
+
     # VMS keeps its include files in system libraries
     if ($^O eq 'VMS') {
 	$file{'Sys$Library:DECC$RTLDEF.TLB'} = 1;
@@ -125,17 +131,12 @@
 	}
     } elsif ($^O eq 'linux' &&
 	      $Config{gccversion} ne '' && 
-	      $Config{gccversion} !~ /intel/i
+	      $Config{gccversion} !~ /intel/i &&
 	      # might be using, say, Intel's icc
+	      $linux_errno_h
 	     ) {
-    # When cross-compiling we may store a path for gcc's "sysroot" option:
-    my $sysroot = $Config{sysroot} || '';
 	# Some Linuxes have weird errno.hs which generate
 	# no #file or #line directives
-	my ($linux_errno_h) = grep { -e $_ } map { "$_/errno.h" }
-	    "$sysroot/usr/include", "$sysroot/usr/local/include",
-	    split / / => $Config{locincpth} or
-		die "Cannot find errno.h";
 	$file{$linux_errno_h} = 1;
     } elsif ($^O eq 'haiku') {
 	# hidden in a special place

Reply via email to