guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/06: gnu: gcc: Fix libstdc++ misconfiguration.


From: guix-commits
Subject: 02/06: gnu: gcc: Fix libstdc++ misconfiguration.
Date: Fri, 24 Jul 2020 08:22:14 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 12dc9f58c422c06bf9950f21c54ca3df1dc40af1
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Jul 24 09:56:25 2020 +0200

    gnu: gcc: Fix libstdc++ misconfiguration.
    
    Fixes <https://bugs.gnu.org/42392>.
    Reported by Maxim Cournoyer and Erik Garrison.
    
    Until now, the generated <bits/c++config.h> would be incorrect (many
    _GLIBCXX_HAVE macros would be undefined), which in turn would lead to
    build failures for most C++ programs.
    
    * gnu/packages/gcc.scm (gcc-6)[inputs]: Add LIBSTDC++-HEADERS.
    (libstdc++, libstdc++-headers): New variables.
    * gnu/packages/gcc.scm (gfortran): Change first argument to 'custom-gcc'
    to remove dependency on LIBSTDC++-HEADERS.
---
 gnu/packages/gcc.scm | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index e0e2361..a39ac3b 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -514,6 +514,12 @@ Go.  It also includes runtime support libraries for these 
languages.")
 
     (inputs
      `(("isl" ,isl)
+
+       ;; XXX: This gross hack allows us to have libstdc++'s <bits/c++config.h>
+       ;; in the search path, thereby avoiding misconfiguration of libstdc++:
+       ;; <https://bugs.gnu.org/42392>.
+       ("libstdc++" ,libstdc++-headers)
+
        ,@(package-inputs gcc-4.7)))))
 
 (define-public gcc-7
@@ -607,6 +613,31 @@ using compilers other than GCC."
     (propagated-inputs '())
     (synopsis "GNU C++ standard library")))
 
+(define libstdc++
+  ;; Libstdc++ matching the default GCC.
+  (make-libstdc++ gcc))
+
+(define libstdc++-headers
+  ;; XXX: This package is for internal use to work around
+  ;; <https://bugs.gnu.org/42392> (see above).  The main difference compared
+  ;; to the libstdc++ headers that come with 'gcc' is that <bits/c++config.h>
+  ;; is right under include/c++ and not under
+  ;; include/c++/x86_64-unknown-linux-gnu (aka. GPLUSPLUS_TOOL_INCLUDE_DIR).
+  (package
+    (inherit libstdc++)
+    (name "libstdc++-headers")
+    (outputs '("out"))
+    (build-system trivial-build-system)
+    (arguments
+     '(#:builder (let* ((out       (assoc-ref %outputs "out"))
+                        (libstdc++ (assoc-ref %build-inputs "libstdc++")))
+                   (mkdir out)
+                   (mkdir (string-append out "/include"))
+                   (symlink (string-append libstdc++ "/include")
+                            (string-append out "/include/c++")))))
+    (inputs `(("libstdc++" ,libstdc++)))
+    (synopsis "Headers of GNU libstdc++")))
+
 (define-public libstdc++-4.9
   (make-libstdc++ gcc-4.9))
 
@@ -689,7 +720,13 @@ as the 'native-search-paths' field."
 
 (define-public gfortran
   (hidden-package
-   (custom-gcc gcc "gfortran" '("fortran")
+   (custom-gcc (package
+                 (inherit gcc)
+                 ;; XXX: Remove LIBSTDC++-HEADERS from the inputs just to
+                 ;; avoid a rebuild of all the GFORTRAN dependents.
+                 ;; TODO: Remove this hack on the next rebuild cycle.
+                 (inputs (alist-delete "libstdc++" (package-inputs gcc))))
+               "gfortran" '("fortran")
                %generic-search-paths)))
 
 (define-public gdc-10



reply via email to

[Prev in Thread] Current Thread [Next in Thread]