From 01e8263febb9634564b4b73af49b81a36567a11b Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 20 Sep 2018 19:56:30 +0200 Subject: [PATCH] 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. --- gnu/build/cross-toolchain.scm | 18 +++++++++++++----- gnu/packages/commencement.scm | 22 +++++++++++++++++----- gnu/packages/cross-base.scm | 7 ++----- gnu/packages/gcc.scm | 8 ++++---- gnu/packages/rust.scm | 5 +---- 5 files changed, 37 insertions(+), 23 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 ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis +;;; Copyright © 2019 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -36,11 +37,8 @@ (define %gcc-include-paths ;; Environment variables for header search paths. - ;; Note: See for why not 'CPATH'. - '("C_INCLUDE_PATH" - "CPLUS_INCLUDE_PATH" - "OBJC_INCLUDE_PATH" - "OBJCPLUS_INCLUDE_PATH")) + ;; Note: See 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))) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 79246a0c5d..92a67acede 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2017, 2018, 2019 Efraim Flashner ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2019 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -1578,6 +1579,7 @@ exec " gcc "/bin/" program "--disable-libsanitizer" "--disable-libitm" "--disable-libgomp" + "--disable-libmpx" "--disable-libcilkrts" "--disable-libvtv" "--disable-libssp" @@ -2118,6 +2120,7 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%" ;; except for the configure-flags. ,@(package-arguments lib) #:configure-flags `("--disable-shared" + "--disable-libstdcxx-dual-abi" "--disable-libstdcxx-threads" "--disable-libstdcxx-pch" ,(string-append "--with-gxx-include-dir=" @@ -2207,6 +2210,15 @@ 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 @@ -2455,23 +2467,23 @@ and binaries, plus debugging symbols in the 'debug' output), and Binutils.") ("libc-debug" ,glibc-final "debug") ("libc-static" ,glibc-final "static"))))) +(define-public gcc-toolchain + (make-gcc-toolchain gcc-final)) + (define-public gcc-toolchain-4.8 (make-gcc-toolchain gcc-4.8)) (define-public gcc-toolchain-4.9 (make-gcc-toolchain gcc-4.9)) -(define-public gcc-toolchain - (make-gcc-toolchain gcc-final)) - (define-public gcc-toolchain-5 - gcc-toolchain) + (make-gcc-toolchain gcc-5)) (define-public gcc-toolchain-6 (make-gcc-toolchain gcc-6)) (define-public gcc-toolchain-7 - (make-gcc-toolchain gcc-7)) + gcc-toolchain) (define-public gcc-toolchain-8 (make-gcc-toolchain gcc-8)) diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 2fcb7fb36b..8fe9d5b6d6 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -51,11 +51,8 @@ (define %gcc-include-paths ;; Environment variables for header search paths. - ;; Note: See for why not 'CPATH'. - '("C_INCLUDE_PATH" - "CPLUS_INCLUDE_PATH" - "OBJC_INCLUDE_PATH" - "OBJCPLUS_INCLUDE_PATH")) + ;; Note: See for why not 'C_INCLUDE_PATH' & co. + '("CPATH")) (define %gcc-cross-include-paths ;; Search path for target headers when cross-compiling. diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 1f1e80dde8..3b6c540221 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -522,7 +522,7 @@ It also includes runtime support libraries for these languages."))) ;; Note: When changing the default gcc version, update ;; the gcc-toolchain-* definitions and the gfortran definition ;; accordingly. -(define-public gcc gcc-5) +(define-public gcc gcc-7) (define-public (make-libstdc++ gcc) "Return a libstdc++ package based on GCC. The primary use case is when @@ -660,7 +660,7 @@ as the 'native-search-paths' field." ;; (custom-gcc gcc "fortran" …) because that would lead to a package object ;; that is not 'eq?' with GFORTRAN-5, and thus 'fold-packages' would ;; report two gfortran@5 that are in fact identical. - gfortran-5) + gfortran-7) (define-public gccgo-4.9 (custom-gcc gcc-4.9 "gccgo" '("go") @@ -724,7 +724,7 @@ as the 'native-search-paths' field." (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) -(define-public gcc-objc gcc-objc-5) +(define-public gcc-objc gcc-objc-7) (define-public gcc-objc++-4.8 (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++") @@ -780,7 +780,7 @@ as the 'native-search-paths' field." (variable "LIBRARY_PATH") (files '("lib" "lib64")))))) -(define-public gcc-objc++ gcc-objc++-5) +(define-public gcc-objc++ gcc-objc++-7) (define (make-libstdc++-doc gcc) "Return a package with the libstdc++ documentation for GCC." diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 501736d898..6e3ea79845 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -406,10 +406,7 @@ test = { path = \"../libtest\" } ;; modules (see ). (native-search-paths (list (search-path-specification - (variable "C_INCLUDE_PATH") - (files '("include"))) - (search-path-specification - (variable "CPLUS_INCLUDE_PATH") + (variable "CPATH") (files '("include"))) (search-path-specification (variable "LIBRARY_PATH")