unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: maxim.cournoyer@gmail.com
Cc: 42392@debbugs.gnu.org
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	[thread overview]
Message-ID: <87a6zqefm6.fsf@gnu.org> (raw)
In-Reply-To: <87imegoplx.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 21 Jul 2020 17:27:22 +0200")

[-- Attachment #1: Type: text/plain, Size: 2134 bytes --]

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’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2173 bytes --]

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	other threads:[~2020-07-23  9:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 13:51 bug#42392: GCC includes ordering issue? g++: error: 'round' is not a member of 'std' maxim.cournoyer
2020-07-21 15:27 ` Ludovic Courtès
2020-07-23  9:37   ` Ludovic Courtès [this message]
2020-07-24 12:24     ` Ludovic Courtès
2020-07-26  5:33   ` Maxim Cournoyer
2020-07-27 18:24     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6zqefm6.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=42392@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).