gnu: libstdc++: Fix cross-compilation.
* gnu/packages/gcc.scm (make-libstdc++): Adjust 'hide-gcc-headers' for cross-compiled libstdc++.
This commit is contained in:
		
							parent
							
								
									b0f1728187
								
							
						
					
					
						commit
						0ad86e94f5
					
				
					 1 changed files with 13 additions and 5 deletions
				
			
		|  | @ -1,5 +1,5 @@ | ||||||
| ;;; GNU Guix --- Functional package management for GNU | ;;; GNU Guix --- Functional package management for GNU | ||||||
| ;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org> | ;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org> | ||||||
| ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org> | ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org> | ||||||
| ;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net> | ;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net> | ||||||
| ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr> | ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr> | ||||||
|  | @ -849,9 +849,12 @@ using compilers other than GCC." | ||||||
|        #:phases |        #:phases | ||||||
|        (modify-phases %standard-phases |        (modify-phases %standard-phases | ||||||
|          ,@(if (version>=? (package-version gcc) "11") |          ,@(if (version>=? (package-version gcc) "11") | ||||||
|                '((add-after 'unpack 'hide-gcc-headers |                `((add-after 'unpack 'hide-gcc-headers | ||||||
|                    (lambda* (#:key native-inputs inputs #:allow-other-keys) |                    (lambda* (#:key native-inputs inputs #:allow-other-keys) | ||||||
|                      (let ((gcc (assoc-ref (or native-inputs inputs) "gcc"))) |                      (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 |                        ;; Fix a regression in GCC 11 where the GCC headers | ||||||
|                        ;; shadows glibc headers when building libstdc++.  An |                        ;; shadows glibc headers when building libstdc++.  An | ||||||
|                        ;; upstream fix was added in GCC 11.3.0, but it only |                        ;; upstream fix was added in GCC 11.3.0, but it only | ||||||
|  | @ -861,11 +864,16 @@ using compilers other than GCC." | ||||||
|                        ;; and the similar adjustment in GCC-FINAL. |                        ;; and the similar adjustment in GCC-FINAL. | ||||||
|                        (substitute* "libstdc++-v3/src/c++17/Makefile.in" |                        (substitute* "libstdc++-v3/src/c++17/Makefile.in" | ||||||
|                          (("AM_CXXFLAGS = ") |                          (("AM_CXXFLAGS = ") | ||||||
|                           (string-append "CPLUS_INCLUDE_PATH = " |                           (string-append ,(if (%current-target-system) | ||||||
|  |                                               "CROSS_CPLUS_INCLUDE_PATH = " | ||||||
|  |                                               "CPLUS_INCLUDE_PATH = ") | ||||||
|                                          (string-join |                                          (string-join | ||||||
|                                           (remove (cut string-prefix? gcc <>) |                                           (remove (cut string-prefix? gcc <>) | ||||||
|                                                   (string-split |                                                   (string-split | ||||||
|                                                    (getenv "CPLUS_INCLUDE_PATH") |                                                    (getenv | ||||||
|  |                                                     ,(if (%current-target-system) | ||||||
|  |                                                          "CROSS_CPLUS_INCLUDE_PATH" | ||||||
|  |                                                          "CPLUS_INCLUDE_PATH")) | ||||||
|                                                    #\:)) |                                                    #\:)) | ||||||
|                                           ":") |                                           ":") | ||||||
|                                          "\nAM_CXXFLAGS = "))))))) |                                          "\nAM_CXXFLAGS = "))))))) | ||||||
|  |  | ||||||
		Reference in a new issue