bug-guix
[Top][All Lists]
Advanced

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

bug#42392: GCC includes ordering issue? g++: error: 'round' is not a mem


From: Ludovic Courtès
Subject: bug#42392: GCC includes ordering issue? g++: error: 'round' is not a member of 'std'
Date: Thu, 23 Jul 2020 11:37:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi!

Ludovic Courtès <ludo@gnu.org> skribis:

> /tmp/guix-build-gcc-10.1.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/config.log
> reads this:
>
> configure:19924: checking for float trig functions
> configure:19948:  /tmp/guix-build-gcc-10.1.0.drv-0/build/./gcc/xgcc 
> -shared-libgcc -B/tmp/guix-build-gcc-10.1.0.drv-0/build/./gcc -nostdinc++ 
> -L/tmp/guix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-linux-gnu/libstdc++-v3/src
>  
> -L/tmp/guix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
>  
> -L/tmp/guix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
>  
> -B/gnu/store/jrzxs91zhpf6yr5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/bin/
>  
> -B/gnu/store/jrzxs91zhpf6yr5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/lib/
>  -isystem 
> /gnu/store/jrzxs91zhpf6yr5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/include
>  -isystem 
> /gnu/store/jrzxs91zhpf6yr5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/sys-include
>    -fno-checking -c -fno-builtin -D_GNU_SOURCE  conftest.cpp >&5
> In file included from 
> /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include/c++/math.h:36,
>                  from conftest.cpp:122:
> /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include/c++/cmath:41:10:
>  fatal error: bits/c++config.h: No such file or directory
>    41 | #include <bits/c++config.h>
>       |          ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> configure:19948: $? = 1
> configure: failed program was:
>
> [...]
>
> | /* end confdefs.h.  */
> | #include <math.h>
> | int
> | main ()
> | {
> | acosf (0); asinf (0); atanf (0); cosf (0); sinf (0); tanf (0); coshf (0); 
> sinhf (0); tanhf (0);
> |   ;
> |   return 0;
> | }
> configure:19962: result: no

The attached patch addresses this with a questionable yet efficient
hack.  The test cases reported by Maxim and by Erik Garrison now build
fine.

I’ve asked for guidance for a proper fix at
<https://gcc.gnu.org/pipermail/gcc-help/2020-July/139204.html>, but in
the meantime, I’m happy to go with this patch.

Thoughts?

Thanks,
Ludo’.

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 9ff5e3d7c0..8969fefd84 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -530,6 +530,12 @@ Go.  It also includes runtime support libraries for these 
languages.")
               (patches (search-patches "gcc-strmov-store-file-names.patch"
                                        "gcc-7-libsanitizer-mode-size.patch"
                                        "gcc-5.0-libvtv-runpath.patch"))))
+    (inputs
+     ;; 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-6)))
     (description
      "GCC is the GNU Compiler Collection.  It provides compiler front-ends
 for several languages, including C, C++, Objective-C, Fortran, Ada, and Go.
@@ -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))
 

reply via email to

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