summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-05-13 20:37:46 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-05-13 21:07:40 +0200
commitfd96ae4a709c5509f2d78af3968d64fe805ad1ef (patch)
tree716efe97acdfd25284e4321a9c2ec0365b968cbf /gnu/packages
parent8ba4d8a347fbdf9fe09e8ac801b4ac0586ac382a (diff)
downloadguix-fd96ae4a709c5509f2d78af3968d64fe805ad1ef.tar.gz
gnu: avr-gcc: Fix conflicting GCC headers.
Fixes <https://bugs.gnu.org/41209>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* gnu/packages/avr.scm (avr-gcc-4.9)[arguments]: Add phase to hide the default
GCC from CPLUS_INCLUDE_PATH.
[native-inputs]: Distinguish GCC-5.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/avr.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 608e487b93..f8884bb6cb 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,6 +50,21 @@
        (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)))
              ;; Without a working multilib build, the resulting GCC lacks
              ;; support for nearly every AVR chip.
              (add-after 'unpack 'fix-genmultilib
@@ -78,7 +94,7 @@
               (variable "CROSS_LIBRARY_PATH")
               (files '("avr/lib")))))
       (native-inputs
-       `(("gcc" ,gcc-5)
+       `(("gcc@5" ,gcc-5)
          ,@(package-native-inputs xgcc))))))
 
 (define-public avr-gcc-5