summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-05-13 20:39:01 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-05-13 21:07:40 +0200
commit7f6d3f395023ff430cf8b7a981d4780698e9d132 (patch)
tree670533f104e47ce631dabdebad27aeedeb13ed8c
parentfd96ae4a709c5509f2d78af3968d64fe805ad1ef (diff)
downloadguix-7f6d3f395023ff430cf8b7a981d4780698e9d132.tar.gz
gnu: gcc-arm-none-eabi: Fix conflicting GCC headers.
Fixes <https://bugs.gnu.org/41210>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* gnu/packages/embedded.scm (gcc-arm-none-eabi-4.9)[arguments]: Add phase to
remove the default compiler from CPLUS_INCLUDE_PATH.
[native-inputs]: Distinguish GCC-5.
-rw-r--r--gnu/packages/embedded.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index 131a928d80..b83b67f4a1 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -87,12 +88,27 @@
                           (origin-patches (package-source xgcc))))))
       (native-inputs
        `(("flex" ,flex)
-         ("gcc" ,gcc-5)
+         ("gcc@5" ,gcc-5)
          ,@(package-native-inputs xgcc)))
       (arguments
        (substitute-keyword-arguments (package-arguments xgcc)
          ((#:phases phases)
           `(modify-phases ,phases
+             (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((gcc (assoc-ref inputs  "gcc")))
+                   ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
+                   ;; prevent header conflict with the GCC from native-inputs.
+                   (setenv "CPLUS_INCLUDE_PATH"
+                           (string-join
+                            (delete (string-append gcc "/include/c++")
+                                    (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                                  #\:))
+                            ":"))
+                   (format #t
+                           "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
+                           (getenv "CPLUS_INCLUDE_PATH"))
+                   #t)))
              (add-after 'unpack 'fix-genmultilib
                (lambda _
                  (substitute* "gcc/genmultilib"