summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-29 23:15:14 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-30 00:17:44 +0200
commit28dc10a455689c807abc9241ed1094d902a9d9fa (patch)
tree7d7b9b3278fdfd740a5963d5807bfdfe974d98a1
parent89d80159b1da81c4017b46a575c3ec5dd9a96c90 (diff)
downloadguix-28dc10a455689c807abc9241ed1094d902a9d9fa.tar.gz
gnu: glibc: Refer to the target kernel headers when cross-compiling.
This fixes a regression introduced in
efc4eb147512fa7a2c6d74d9b296cfc22b1ef198 whereby the build process
corresponding to 'guix build glibc --target=mips64el-linux-gnu' would
refer to the native headers instead of the target headers, leading to a
build failure:

  ../sysdeps/unix/sysv/linux/statfs64.c: In function ‘__statfs64’:
  ../sysdeps/unix/sysv/linux/statfs64.c:73:1: error: control reaches end of non-void function [-Werror=return-type]
   }
   ^

When we were using CROSS_CPATH instead of CROSS_C_INCLUDE_PATH, the
problem was hidden by the fact that CPATH corresponds to '-I' whereas
C_INCLUDE_PATH corresponds to '-isystem', and '-isystem' directories are
searched after '-I' directories.

* gnu/packages/base.scm (glibc)[arguments]: Refer to the kernel headers
from '%build-target-inputs' when cross-building.
-rw-r--r--gnu/packages/base.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index beb689ea95..b5e229e06c 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -532,7 +532,10 @@ store.")
                            ,version)
 
             (string-append "--with-headers="
-                           (assoc-ref %build-inputs "linux-headers")
+                           (assoc-ref ,(if (%current-target-system)
+                                           '%build-target-inputs
+                                           '%build-inputs)
+                                      "linux-headers")
                            "/include")
 
             ;; This is the default for most architectures as of GNU libc 2.21,