Toggle diff (100 lines)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 851bb02163..473d6b8345 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014, 2015, 2017 Mark H Weaver <mhw@netris.org>
@@ -2303,15 +2303,6 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
char-set:letter)
,(package-name lib)))
(list gmp-6.0 mpfr mpc))
- #t)))
- (add-before 'configure 'treat-glibc-as-system-header
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((libc (assoc-ref inputs "libc")))
- ;; Make sure Glibc is treated as a "system header" so
- ;; #include_next does the right thing.
- (for-each (lambda (var)
- (setenv var (string-append libc "/include")))
- '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
#t))))))))
;; This time we want Texinfo, so we get the manual. Add
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 40cc9ed631..4c4b63dbd1 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
@@ -340,7 +340,9 @@ where the OS part is overloaded to denote a specific ABI---into GCC
(files '("include")))
(search-path-specification
(variable "CPLUS_INCLUDE_PATH")
- (files '("include")))
+ ;; Add 'include/c++' here so that <cstdlib>'s "#include_next
+ ;; <stdlib.h>" finds GCC's <stdlib.h>, not libc's.
+ (files '("include/c++" "include")))
(search-path-specification
(variable "LIBRARY_PATH")
(files '("lib" "lib64")))))
@@ -476,17 +478,7 @@ Go. It also includes runtime support libraries for these languages.")
"gcc-5.0-libvtv-runpath.patch"))))
(inputs
`(("isl" ,isl)
- ,@(package-inputs gcc-4.7)))
-
- (native-search-paths
- ;; We have to use 'CPATH' for GCC > 5, not 'C_INCLUDE_PATH' & co., due to
- ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129>.
- (list (search-path-specification
- (variable "CPATH")
- (files '("include")))
- (search-path-specification
- (variable "LIBRARY_PATH")
- (files '("lib" "lib64")))))))
+ ,@(package-inputs gcc-4.7)))))
(define-public gcc-7
(package
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index 3cc89f8852..6e66f5ffce 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -296,13 +296,19 @@ standard packages used as implicit inputs of the GNU build system."
`(("source" ,source))
'())
,@native-inputs
+
+ ;; When not cross-compiling, ensure implicit inputs come
+ ;; last. That way, libc headers come last, which allows
+ ;; #include_next to work correctly; see
+ ;; <https://bugs.gnu.org/30756>.
+ ,@(if target '() inputs)
,@(if (and target implicit-cross-inputs?)
(standard-cross-packages target 'host)
'())
,@(if implicit-inputs?
(standard-packages)
'())))
- (host-inputs inputs)
+ (host-inputs (if target inputs '()))
;; The cross-libc is really a target package, but for bootstrapping
;; reasons, we can't put it in 'host-inputs'. Namely, 'cross-gcc' is a