all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Svante Signell <svante.signell@gmail.com>
To: zamfofex <zamfofex@twdb.moe>
Cc: guix-devel@gnu.org
Subject: Re: GMP GCC C++ Hurd cross-build failure on core-updates
Date: Mon, 19 Dec 2022 11:57:09 +0100	[thread overview]
Message-ID: <1758d2908f1b9b6021f949389b883ebf03c2b007.camel@gmail.com> (raw)
In-Reply-To: <1677ec443794a5c95a37d3eccd60c28c0c3a260e.camel@gmail.com>

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

On Thu, 2022-12-15 at 12:17 +0100, Svante Signell wrote:
> 
> Hi,
> 
> The problem is probably that you need to add --enable-add-ons=libpthread to
> configure when building first version of cross-glibc. This is to obtain weak
> references when building libcstd++ of cross-gcc:
> 
> nm --dynamic /cross-tools/lib/libstdc++.so.6.0.30|grep pthread
> ...
> w __pthread_key_create
> w pthread_key_create
> w pthread_key_delete

I've been looking into this problem a little further: You need the attached
patch: libstdc++-hurd.diff, at least for gcc-11 and gcc-12 (and probably gcc-13
too)


Good luck!

[-- Attachment #2: libstdc++-hurd.diff --]
[-- Type: text/x-patch, Size: 1835 bytes --]

This is notably needed because in glibc 2.34, the move of pthread functions
into libc.so happened for Linux only, not GNU/Hurd.

The pthread_self() function can also always be used fine as it is on
GNU/Hurd.

libstdc++-v3/ChangeLog:

        * config/os/gnu-linux/os_defines.h [!__linux__]
          (_GLIBCXX_NATIVE_THREAD_ID, _GLIBCXX_GTHREAD_USE_WEAK): Do not define.

--- a/libstdc++-v3/config/os/gnu-linux/os_defines.h
+++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h
@@ -49,22 +49,24 @@
 // version dynamically in case it has changed since libstdc++ was configured.
 #define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC __GLIBC_PREREQ(2,23)
 
-#if __GLIBC_PREREQ(2, 27)
-// Since glibc 2.27 pthread_self() is usable without linking to libpthread.
-# define _GLIBCXX_NATIVE_THREAD_ID pthread_self()
-#else
+#ifdef __linux__
+# if __GLIBC_PREREQ(2, 27)
+// Since glibc 2.27 Linux' pthread_self() is usable without linking to libpthread.
+#  define _GLIBCXX_NATIVE_THREAD_ID pthread_self()
+# else
 // Before then it was in libc.so.6 but not libc.a, and always returns 0,
 // which breaks the invariant this_thread::get_id() != thread::id{}.
 // So only use it if we know the libpthread version is available.
 // Otherwise use (__gthread_t)1 as the ID of the main (and only) thread.
-# define _GLIBCXX_NATIVE_THREAD_ID \
-  (__gthread_active_p() ? __gthread_self() : (__gthread_t)1)
-#endif
+#  define _GLIBCXX_NATIVE_THREAD_ID \
+   (__gthread_active_p() ? __gthread_self() : (__gthread_t)1)
+# endif
 
-#if __GLIBC_PREREQ(2, 34)
-// Since glibc 2.34 all pthreads functions are usable without linking to
+# if __GLIBC_PREREQ(2, 34)
+// Since glibc 2.34 all Linux pthreads functions are usable without linking to
 // libpthread.
-# define _GLIBCXX_GTHREAD_USE_WEAK 0
+#  define _GLIBCXX_GTHREAD_USE_WEAK 0
+# endif
 #endif
 
 #endif

  reply	other threads:[~2022-12-19 10:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15  7:24 GMP GCC C++ Hurd cross-build failure on core-updates Nathan Dehnel
2022-12-15 11:17 ` Svante Signell
2022-12-19 10:57   ` Svante Signell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-12-04  7:23 zamfofex
2022-12-04 16:46 ` Joshua Branson
2022-12-05 16:08 ` Ludovic Courtès
2022-12-06 10:06   ` zamfofex
2022-12-06 11:20     ` zamfofex
2022-12-08 15:43       ` Ludovic Courtès
2022-12-19 21:06     ` 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

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

  git send-email \
    --in-reply-to=1758d2908f1b9b6021f949389b883ebf03c2b007.camel@gmail.com \
    --to=svante.signell@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=zamfofex@twdb.moe \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.