summary refs log tree commit diff
path: root/gnu/build/cross-toolchain.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-09-20 19:56:30 +0200
committerMarius Bakke <mbakke@fastmail.com>2019-02-09 21:53:41 +0100
commit01e8263febb9634564b4b73af49b81a36567a11b (patch)
treea677ded14474ed0ba2b84a800592ac0577b56b27 /gnu/build/cross-toolchain.scm
parentde92ab21c162e69bd15b7215ade61bc47603c8bc (diff)
downloadguix-01e8263febb9634564b4b73af49b81a36567a11b.tar.gz
gnu: Use GCC 7 as the default compiler.
* gnu/packages/cross-base.scm (%gcc-cross-include-paths): Remove
CROSS_C_INCLUDE_PATH & co in favor of CROSS_CPATH.
* gnu/build/cross-toolchain.scm (%gcc-cross-include-paths): Likewise.
(cross-gcc-build-phases): Set CROSS_C_INCLUDE_PATH and
CROSS_CPLUS_INCLUDE_PATH when building the cross GCC.
* gnu/packages/commencement.scm (libstdc++): Add
"--disable-libstdcxx-dual-abi" to #:configure-flags.
(gcc-boot0)[arguments]: Add "--disable-libmpx"
to #:configure-flags.
(gcc-final): Add phase to set C_INCLUDE_PATH and CPLUS_INCLUDE_PATH before
building GCC.
(gcc-toolchain-5): Use MAKE-GCC-TOOLCHAIN.
(gcc-toolchain-7): Change to GCC-TOOLCHAIN.
* gnu/packages/gcc.scm (gcc): Change from GCC-5 to GCC-7.
(gfortran): Change to GFORTRAN-7.
(gcc-objc): Change to GCC-OBJC-7.
(gcc-objc++): Change to GCC-OBJC++-7.
* gnu/packages/rust.scm (rust-1.19.0)[native-search-paths]: Change from
C_INCLUDE_PATH & co to CPATH.
Diffstat (limited to 'gnu/build/cross-toolchain.scm')
-rw-r--r--gnu/build/cross-toolchain.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm
index d430b8afc4..0b5450d1b4 100644
--- a/gnu/build/cross-toolchain.scm
+++ b/gnu/build/cross-toolchain.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
+;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -36,11 +37,8 @@
 
 (define %gcc-include-paths
   ;; Environment variables for header search paths.
-  ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
-  '("C_INCLUDE_PATH"
-    "CPLUS_INCLUDE_PATH"
-    "OBJC_INCLUDE_PATH"
-    "OBJCPLUS_INCLUDE_PATH"))
+  ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
+  '("CPATH"))
 
 (define %gcc-cross-include-paths
   ;; Search path for target headers when cross-compiling.
@@ -171,6 +169,16 @@ a target triplet."
       (if (string-contains target "mingw")
           set-cross-path/mingw
           set-cross-path))
+    (add-before 'configure 'treat-glibc-as-system-header
+      (lambda* (#:key inputs #:allow-other-keys)
+        (let ((libc (assoc-ref inputs "libc")))
+          (when libc
+            ;; For GCC6 and later, make sure Glibc is treated as a "system
+            ;; header" such that #include_next does the right thing.
+            (for-each (lambda (var)
+                        (setenv var (string-append libc "/include")))
+                      '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH")))
+          #t)))
     (add-after 'install 'make-cross-binutils-visible
       (cut make-cross-binutils-visible #:target target <...>))
     (replace 'install install-strip)))