gnu: gcc: Switch back to using 'C_INCLUDE_PATH' instead of 'CPATH'.

Fixes <https://bugs.gnu.org/30756>.
Initially reported by Julien Lepiller <julien@lepiller.eu>.

* gnu/packages/base.scm (make-gcc-libc): Remove
'treat-glibc-as-system-header' phase from 'arguments'.
* gnu/packages/commencement.scm (gcc-final): Likewise.
* gnu/packages/gcc.scm (gcc-4.7)[arguments]: Add "include/c++" to
'CPLUS_INCLUDE_PATH'.
(gcc-6)[native-search-paths]: Remove.
* gnu/packages/make-bootstrap.scm (gcc-for-bootstrap): Remove
'native-search-paths' and 'arguments'.
* gnu/packages/patches/python-2.7-search-paths.patch,
gnu/packages/patches/python-3-search-paths.patch: Replace "CPATH" with
"C_INCLUDE_PATH".
* guix/build-system/cmake.scm (lower): When not cross-compiling, move
INPUTS from the 'host-inputs' field to the 'build-inputs' field of the
bag, right after NATIVE-INPUTS.
* guix/build-system/glib-or-gtk.scm (lower): Likewise.
* guix/build-system/gnu.scm (lower): Likewise.
* guix/build-system/meson.scm (lower): Likewise.
This commit is contained in:
Ludovic Courtès 2020-02-06 15:32:00 +01:00
parent 558b0bbe29
commit 2073b55e6b
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
10 changed files with 40 additions and 84 deletions

View file

@ -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, 2019 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014, 2015, 2016, 2018 Mark H Weaver <mhw@netris.org>
@ -981,21 +981,8 @@ (define-public (make-gcc-libc base-gcc libc)
(package-name libc) "-"
(package-version libc)))
(arguments
(substitute-keyword-arguments
(ensure-keyword-arguments (package-arguments base-gcc)
'(#:implicit-inputs? #f))
((#:phases phases)
`(modify-phases ,phases
(add-before 'configure 'treat-glibc-as-system-header
(lambda _
(let ((libc (assoc-ref %build-inputs "libc")))
;; GCCs build processes requires that the libc
;; we're building against is on the system header
;; search path.
(for-each (lambda (var)
(setenv var (string-append libc "/include")))
'("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
#t)))))))
(ensure-keyword-arguments (package-arguments base-gcc)
'(#:implicit-inputs? #f)))
(native-inputs
`(,@(package-native-inputs base-gcc)
,@(append (fold alist-delete (%final-inputs) '("libc" "libc:static")))

View file

@ -2193,15 +2193,6 @@ (define gcc-final
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

View file

@ -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 @@ (define-public gcc-4.7
(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 @@ (define-public gcc-6
"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

View file

@ -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 © 2017 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018, 2019 Mark H Weaver <mhw@netris.org>
@ -95,32 +95,11 @@ (define gcc-for-bootstrap
(package
(inherit gcc)
(outputs '("out")) ;all in one so libgcc_s is easily found
(native-search-paths
;; Set CPLUS_INCLUDE_PATH so GCC is able to find the libc
;; C++ headers.
(cons (search-path-specification
(variable "CPLUS_INCLUDE_PATH")
(files '("include")))
(package-native-search-paths gcc)))
(inputs
`( ;; Distinguish the name so we can refer to it below.
("bootstrap-libc" ,(glibc-for-bootstrap glibc))
("libc:static" ,(glibc-for-bootstrap glibc) "static")
,@(package-inputs gcc)))
(arguments
(substitute-keyword-arguments (package-arguments gcc)
((#:phases phases)
`(modify-phases ,phases
(add-before 'configure 'treat-glibc-as-system-header
(lambda* (#:key inputs #:allow-other-keys)
(let ((libc (assoc-ref inputs "bootstrap-libc")))
;; GCCs build processes requires that the libc
;; we're building against is on the system header
;; search path.
(for-each (lambda (var)
(setenv var (string-append libc "/include")))
'("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
#t))))))))))
,@(package-inputs gcc))))))
(define (package-with-relocatable-glibc p)
"Return a variant of P that uses the libc as defined by

View file

@ -1,4 +1,4 @@
Make sure the build system honors CPATH and LIBRARY_PATH when
Make sure the build system honors C_INCLUDE_PATH and LIBRARY_PATH when
looking for headers and libraries.
--- Python-2.7.10/setup.py 2015-10-07 18:33:18.125153186 +0200
@ -10,7 +10,7 @@ looking for headers and libraries.
+ # Always honor these variables.
+ if not cross_compiling:
+ lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
+ inc_dirs += os.getenv('CPATH', '').split(os.pathsep)
+ inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
+ else:
+ lib_dirs = os.getenv('CROSS_LIBRARY_PATH', '').split(os.pathsep)
+ inc_dirs = os.getenv('CROSS_CPATH', '').split(os.pathsep)

View file

@ -1,4 +1,4 @@
Make sure the build system honors CPATH and LIBRARY_PATH when
Make sure the build system honors C_INCLUDE_PATH and LIBRARY_PATH when
looking for headers and libraries.
--- a/setup.py 2015-10-07 23:32:58.891329173 +0200
@ -10,7 +10,7 @@ looking for headers and libraries.
- self.lib_dirs = self.compiler.library_dirs + system_lib_dirs
- self.inc_dirs = self.compiler.include_dirs + system_include_dirs
+ self.lib_dirs = os.getenv('LIBRARY_PATH', '').split(os.pathsep)
+ self.inc_dirs = os.getenv('CPATH', '').split(os.pathsep)
+ self.inc_dirs = os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
else:
# Add the sysroot paths. 'sysroot' is a compiler option used to
# set the logical path of the standard system headers and

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;;
@ -72,6 +72,7 @@ (define private-keywords
'())
,@`(("cmake" ,cmake))
,@native-inputs
,@(if target '() inputs)
,@(if target
;; Use the standard cross inputs of
;; 'gnu-build-system'.
@ -79,7 +80,7 @@ (define private-keywords
'())
;; Keep the standard inputs of 'gnu-build-system'.
,@(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

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
;;;
@ -92,15 +92,15 @@ (define private-keywords
(bag
(name name)
(system system)
(host-inputs `(,@(if source
`(("source" ,source))
'())
,@inputs))
(build-inputs `(("glib:bin" ,glib "bin") ; to compile schemas
(host-inputs (if source
`(("source" ,source))
'()))
(build-inputs `(,@native-inputs
,@inputs
("glib:bin" ,glib "bin") ; to compile schemas
,@(if implicit-inputs?
(standard-packages)
'())
,@native-inputs))
'())))
(outputs outputs)
(build glib-or-gtk-build)
(arguments (strip-keyword-arguments private-keywords arguments)))))

View file

@ -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 @@ (define private-keywords
`(("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

View file

@ -74,13 +74,13 @@ (define private-keywords
(system system)
(build-inputs `(("meson" ,meson)
("ninja" ,ninja)
,@native-inputs))
(host-inputs `(,@(if source
`(("source" ,source))
'())
,@inputs
;; Keep the standard inputs of 'gnu-build-system'.
,@(standard-packages)))
,@native-inputs
,@inputs
;; Keep the standard inputs of 'gnu-build-system'.
,@(standard-packages)))
(host-inputs (if source
`(("source" ,source))
'()))
(outputs outputs)
(build meson-build)
(arguments (strip-keyword-arguments private-keywords arguments)))))