guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: guix-commits
Subject: 03/03: gnu: gcc: Switch back to using 'C_INCLUDE_PATH' instead of 'CPATH'.
Date: Thu, 6 Feb 2020 12:47:30 -0500 (EST)

civodul pushed a commit to branch core-updates
in repository guix.

commit 2073b55e6b964cb8ca15e8c74cb32dac00f05f0d
Author: Ludovic Courtès <address@hidden>
AuthorDate: Thu Feb 6 15:32:00 2020 +0100

    gnu: gcc: Switch back to using 'C_INCLUDE_PATH' instead of 'CPATH'.
    
    Fixes <https://bugs.gnu.org/30756>.
    Initially reported by Julien Lepiller <address@hidden>.
    
    * 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.
---
 gnu/packages/base.scm                              | 19 +++-------------
 gnu/packages/commencement.scm                      |  9 --------
 gnu/packages/gcc.scm                               | 18 +++++-----------
 gnu/packages/make-bootstrap.scm                    | 25 ++--------------------
 gnu/packages/patches/python-2.7-search-paths.patch |  4 ++--
 gnu/packages/patches/python-3-search-paths.patch   |  4 ++--
 guix/build-system/cmake.scm                        |  5 +++--
 guix/build-system/glib-or-gtk.scm                  | 16 +++++++-------
 guix/build-system/gnu.scm                          | 10 +++++++--
 guix/build-system/meson.scm                        | 14 ++++++------
 10 files changed, 40 insertions(+), 84 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 45f6cf7..05a48ce 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès 
<address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic 
Courtès <address@hidden>
 ;;; Copyright © 2014, 2019 Andreas Enge <address@hidden>
 ;;; Copyright © 2012 Nikita Karetnikov <address@hidden>
 ;;; Copyright © 2014, 2015, 2016, 2018 Mark H Weaver <address@hidden>
@@ -981,21 +981,8 @@ with the Linux kernel.")
                                 (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")))
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index e26bc1c..2a0a83a 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2193,15 +2193,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 94f7e15..69bac8d 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 
<address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic 
Courtès <address@hidden>
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <address@hidden>
 ;;; Copyright © 2014, 2015, 2016, 2017, 2019 Ricardo Wurmus <address@hidden>
 ;;; Copyright © 2015 Andreas Enge <address@hidden>
@@ -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/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 0144a6e..eea5975 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès 
<address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic 
Courtès <address@hidden>
 ;;; Copyright © 2017 Efraim Flashner <address@hidden>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <address@hidden>
 ;;; Copyright © 2018, 2019 Mark H Weaver <address@hidden>
@@ -95,32 +95,11 @@ for `sh' in $PATH, and without nscd, and with static NSS 
modules."
     (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
diff --git a/gnu/packages/patches/python-2.7-search-paths.patch 
b/gnu/packages/patches/python-2.7-search-paths.patch
index 5a345c7..3318f44 100644
--- a/gnu/packages/patches/python-2.7-search-paths.patch
+++ b/gnu/packages/patches/python-2.7-search-paths.patch
@@ -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)
diff --git a/gnu/packages/patches/python-3-search-paths.patch 
b/gnu/packages/patches/python-3-search-paths.patch
index aaf7236..612201d 100644
--- a/gnu/packages/patches/python-3-search-paths.patch
+++ b/gnu/packages/patches/python-3-search-paths.patch
@@ -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
diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index 1fc0931..29259c5 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2014, 2015, 2020 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2013 Cyril Roelandt <address@hidden>
 ;;; Copyright © 2017 Ricardo Wurmus <address@hidden>
 ;;;
@@ -72,6 +72,7 @@
                           '())
                     ,@`(("cmake" ,cmake))
                     ,@native-inputs
+                    ,@(if target '() inputs)
                     ,@(if target
                           ;; Use the standard cross inputs of
                           ;; 'gnu-build-system'.
@@ -79,7 +80,7 @@
                           '())
                     ;; 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
diff --git a/guix/build-system/glib-or-gtk.scm 
b/guix/build-system/glib-or-gtk.scm
index 8de7dfb..fb1f8fb 100644
--- a/guix/build-system/glib-or-gtk.scm
+++ b/guix/build-system/glib-or-gtk.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2019 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2014, 2015, 2019, 2020 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2013 Cyril Roelandt <address@hidden>
 ;;; Copyright © 2014 Federico Beffa <address@hidden>
 ;;;
@@ -92,15 +92,15 @@
        (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)))))
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index 3cc89f8..6e66f5f 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 
<address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020 Ludovic Courtès 
<address@hidden>
 ;;;
 ;;; 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
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index b29f2f4..b68bcb8 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -74,13 +74,13 @@
          (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)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]