diff options
Diffstat (limited to 'gnu/packages/gcc.scm')
-rw-r--r-- | gnu/packages/gcc.scm | 140 |
1 files changed, 94 insertions, 46 deletions
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index bf3c753b2d..ce6e3e7a83 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -1,12 +1,12 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012-2022 Ludovic Courtès <[email protected]> +;;; Copyright © 2012-2023 Ludovic Courtès <[email protected]> ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <[email protected]> ;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <[email protected]> ;;; Copyright © 2015 Andreas Enge <[email protected]> ;;; Copyright © 2015-2018, 2020-2023 Efraim Flashner <[email protected]> ;;; Copyright © 2016 Carlos Sánchez de La Lama <[email protected]> ;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]> -;;; Copyright © 2018, 2020 Marius Bakke <[email protected]> +;;; Copyright © 2018, 2020, 2022 Marius Bakke <[email protected]> ;;; Copyright © 2020 Joseph LaFreniere <[email protected]> ;;; Copyright © 2020 Guy Fleury Iteriteka <[email protected]> ;;; Copyright © 2020 Simon Tournier <[email protected]> @@ -173,7 +173,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC "lib" ;libgcc_s, libgomp, etc. (15+ MiB) "debug")) ;debug symbols of run-time libraries - (inputs (list gmp mpfr mpc libelf zlib)) + (inputs (list gmp mpfr mpc elfutils zlib)) ;; GCC < 5 is one of the few packages that doesn't ship .info files. ;; Newer texinfos fail to build the manual, so we use an older one. @@ -182,7 +182,16 @@ where the OS part is overloaded to denote a specific ABI---into GCC (arguments `(#:out-of-source? #t - #:configure-flags ,(configure-flags) + #:configure-flags ,(let ((flags (configure-flags)) + (version (package-version this-package))) + ;; GCC 4.9 and 5.0 requires C++11 but GCC + ;; 11.3.0 defaults to C++17, which is partly + ;; incompatible. Force C++11. + (if (or (version-prefix? "4.9" version) + (version-prefix? "5" version)) + `(cons "CXX=g++ -std=c++11" ,flags) + flags)) + #:make-flags ;; None of the flags below are needed when doing a Canadian cross. ;; TODO: Simplify this. @@ -295,15 +304,13 @@ where the OS part is overloaded to denote a specific ABI---into GCC (substitute* "gcc/config/aarch64/t-aarch64-linux" (("lib64") "lib"))) - ;; TODO: Make this unconditional in core-updates. ;; The STARTFILE_PREFIX_SPEC prevents gcc from finding the ;; gcc:lib output, which causes ld to not find -lgcc_s. - ,@(if (target-riscv64?) - `((when (file-exists? "gcc/config/riscv") - (substitute* "gcc/config/riscv/linux.h" - (("define STARTFILE_PREFIX_SPEC") - "define __STARTFILE_PREFIX_SPEC")))) - '()) + (when (file-exists? "gcc/config/riscv") + (substitute* '("gcc/config/riscv/linux.h" + "gcc/config/riscv/riscv.h") ; GCC < 10 + (("define STARTFILE_PREFIX_SPEC") + "define __STARTFILE_PREFIX_SPEC"))) (when (file-exists? "libbacktrace") ;; GCC 4.8+ comes with libbacktrace. By default it builds @@ -441,30 +448,36 @@ Go. It also includes runtime support libraries for these languages.") (native-inputs (list perl ;for manpages texinfo)) (arguments - (if (%current-target-system) - (package-arguments gcc-4.8) - ;; For native builds of GCC 4.9 and GCC 5, the C++ include path needs - ;; to be adjusted so it does not interfere with GCC's own build processes. - (substitute-keyword-arguments (package-arguments gcc-4.8) - ((#:modules modules %gnu-build-system-modules) - `((srfi srfi-1) - ,@modules)) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH - (lambda* (#:key inputs #:allow-other-keys) - (let ((libc (assoc-ref inputs "libc")) - (gcc (assoc-ref inputs "gcc"))) - (setenv "CPLUS_INCLUDE_PATH" - (string-join (fold delete - (string-split (getenv "CPLUS_INCLUDE_PATH") - #\:) - (list (string-append libc "/include") - (string-append gcc "/include/c++"))) - ":")) - (format #t - "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%" - (getenv "CPLUS_INCLUDE_PATH")))))))))))) + ;; Since 'arguments' is a function of the package's version, define + ;; 'parent' such that the 'arguments' thunk gets to see the right + ;; version. + (let ((parent (package + (inherit gcc-4.8) + (version (package-version this-package))))) + (if (%current-target-system) + (package-arguments parent) + ;; For native builds of GCC 4.9 and GCC 5, the C++ include path needs + ;; to be adjusted so it does not interfere with GCC's own build processes. + (substitute-keyword-arguments (package-arguments parent) + ((#:modules modules %gnu-build-system-modules) + `((srfi srfi-1) + ,@modules)) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH + (lambda* (#:key inputs #:allow-other-keys) + (let ((libc (assoc-ref inputs "libc")) + (gcc (assoc-ref inputs "gcc"))) + (setenv "CPLUS_INCLUDE_PATH" + (string-join (fold delete + (string-split (getenv "CPLUS_INCLUDE_PATH") + #\:) + (list (string-append libc "/include") + (string-append gcc "/include/c++"))) + ":")) + (format #t + "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%" + (getenv "CPLUS_INCLUDE_PATH"))))))))))))) (define gcc-canadian-cross-objdump-snippet ;; Fix 'libcc1/configure' error when cross-compiling GCC. Without that, @@ -658,16 +671,17 @@ It also includes runtime support libraries for these languages.") (define-public gcc-10 (package (inherit gcc-8) - (version "10.3.0") + (version "10.4.0") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/gcc/gcc-" version "/gcc-" version ".tar.xz")) (sha256 (base32 - "0i6378ig6h397zkhd7m4ccwjx5alvzrf2hm27p1pzwjhlv0h9x34")) + "1wg4xdizkksmwi66mvv2v4pk3ja8x64m7v9gzhykzd3wrmdpsaf9")) (patches (search-patches "gcc-9-strmov-store-file-names.patch" - "gcc-5.0-libvtv-runpath.patch")) + "gcc-5.0-libvtv-runpath.patch" + "gcc-10-tree-sra-union-handling.patch")) (modules '((guix build utils))) (snippet gcc-canadian-cross-objdump-snippet))) (properties @@ -688,7 +702,8 @@ It also includes runtime support libraries for these languages.") (base32 "0fdclcwf728wbq52vphfcjywzhpsjp3kifzj3pib3xcihs0z4z5l")) (patches (search-patches "gcc-9-strmov-store-file-names.patch" - "gcc-5.0-libvtv-runpath.patch")) + "gcc-5.0-libvtv-runpath.patch" + "gcc-10-tree-sra-union-handling.patch")) (modules '((guix build utils))) (snippet gcc-canadian-cross-objdump-snippet))) @@ -718,7 +733,7 @@ It also includes runtime support libraries for these languages.") ;; Note: When changing the default gcc version, update ;; the gcc-toolchain-* definitions. -(define-public gcc gcc-10) +(define-public gcc gcc-11) ;;; @@ -828,8 +843,41 @@ using compilers other than GCC." (name "libstdc++") (arguments `(#:out-of-source? #t + #:modules ((srfi srfi-1) + (srfi srfi-26) + ,@%gnu-build-system-modules) #:phases (modify-phases %standard-phases + ,@(if (version>=? (package-version gcc) "11") + `((add-after 'unpack 'hide-gcc-headers + (lambda* (#:key native-inputs inputs #:allow-other-keys) + (let ((gcc (assoc-ref (or native-inputs inputs) + ,(if (%current-target-system) + "cross-gcc" + "gcc")))) + ;; Fix a regression in GCC 11 where the GCC headers + ;; shadows glibc headers when building libstdc++. An + ;; upstream fix was added in GCC 11.3.0, but it only + ;; hides system include directories, not those on + ;; CPLUS_INCLUDE_PATH. See discussion at + ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017> + ;; and the similar adjustment in GCC-FINAL. + (substitute* "libstdc++-v3/src/c++17/Makefile.in" + (("AM_CXXFLAGS = ") + (string-append ,(if (%current-target-system) + "CROSS_CPLUS_INCLUDE_PATH = " + "CPLUS_INCLUDE_PATH = ") + (string-join + (remove (cut string-prefix? gcc <>) + (string-split + (getenv + ,(if (%current-target-system) + "CROSS_CPLUS_INCLUDE_PATH" + "CPLUS_INCLUDE_PATH")) + #\:)) + ":") + "\nAM_CXXFLAGS = "))))))) + '()) ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64. (add-before 'chdir 'fix-rs6000-libdir (lambda _ @@ -1141,7 +1189,7 @@ provides the GNU compiler for the Go programming language.")) (custom-gcc gcc-12 "gcc-objc" '("objc") %objc-search-paths)) -(define-public gcc-objc gcc-objc-10) +(define-public gcc-objc gcc-objc-11) (define %objc++-search-paths (list (search-path-specification @@ -1191,7 +1239,7 @@ provides the GNU compiler for the Go programming language.")) (custom-gcc gcc-12 "gcc-objc++" '("obj-c++") %objc++-search-paths)) -(define-public gcc-objc++ gcc-objc++-10) +(define-public gcc-objc++ gcc-objc++-11) (define (make-libstdc++-doc gcc) "Return a package with the libstdc++ documentation for GCC." @@ -1252,16 +1300,16 @@ provides the GNU compiler for the Go programming language.")) (define-public isl (package (name "isl") - (version "0.23") + (version "0.24") (source (origin (method url-fetch) (uri (list (string-append "mirror://sourceforge/libisl/isl-" - version ".tar.bz2") + version ".tar.xz") (string-append %gcc-infrastructure - "isl-" version ".tar.bz2"))) + "isl-" version ".tar.xz"))) (sha256 (base32 - "0k91zck10zxs9sk3yrbb92y1j3w981w3fbwkfwd7kl779b0j52f5")))) + "1bgbk6n93qqn7w8v21kxf4x6dc3z0ypqrzvgfd46nhagak60ac84")))) (build-system gnu-build-system) (outputs '("out" "static")) (arguments |