Re: python3.8 ftbfs on the Hurd and KFreeBSD
Hello,
Matthias Klose, le lun. 08 juil. 2019 13:37:00 +0200, a ecrit:
> The hurd-i386 and kfreebsd-* builds had some missing symbols, seen in
>
> https://buildd.debian.org/status/fetch.php?pkg=python3.8&arch=hurd-i386&ver=3.8.0%7Eb2-1&stamp=1562346528&raw=0
> https://buildd.debian.org/status/fetch.php?pkg=python3.8&arch=kfreebsd-amd64&ver=3.8.0%7Eb1-2&stamp=1560770610&raw=0
Here is a mach implementation for the native thread ids, and the patch
to enable the symbol on hurd-any too.
Samuel
Index: python3.8-3.8.0~b2/Include/pythread.h
===================================================================
--- python3.8-3.8.0~b2.orig/Include/pythread.h
+++ python3.8-3.8.0~b2/Include/pythread.h
@@ -26,7 +26,7 @@ PyAPI_FUNC(unsigned long) PyThread_start
PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void);
PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void);
-#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(_WIN32) || defined(_AIX)
+#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(_WIN32) || defined(_AIX) || defined(__GNU__)
#define PY_HAVE_THREAD_NATIVE_ID
PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void);
#endif
Index: python3.8-3.8.0~b2/Python/thread_pthread.h
===================================================================
--- python3.8-3.8.0~b2.orig/Python/thread_pthread.h
+++ python3.8-3.8.0~b2/Python/thread_pthread.h
@@ -22,6 +22,9 @@
# include <sys/thread.h> /* thread_self() */
#elif defined(__NetBSD__)
# include <lwp.h> /* _lwp_self() */
+#elif defined(__GNU__)
+# include <mach.h> /* mach_thread_self(), mach_task_self(),
+ mach_port_deallocate() */
#endif
/* The POSIX spec requires that use of pthread_attr_setstacksize
@@ -338,6 +341,10 @@ PyThread_get_thread_native_id(void)
#elif defined(__NetBSD__)
lwpid_t native_id;
native_id = _lwp_self();
+#elif defined(__GNU__)
+ mach_port_t native_id;
+ native_id = mach_thread_self();
+ mach_port_deallocate(mach_task_self(), mach_thread_self());
#endif
return (unsigned long) native_id;
}
Index: python3.8-3.8.0~b2/debian/libpython.symbols.in
===================================================================
--- python3.8-3.8.0~b2.orig/debian/libpython.symbols.in
+++ python3.8-3.8.0~b2/debian/libpython.symbols.in
@@ -913,7 +913,7 @@
PyThread_get_key_value@Base @SVER@
PyThread_get_stacksize@Base @SVER@
PyThread_get_thread_ident@Base @SVER@
- (arch=linux-any)PyThread_get_thread_native_id@Base @SVER@
+ (arch=linux-any hurd-any)PyThread_get_thread_native_id@Base @SVER@
PyThread_init_thread@Base @SVER@
PyThread_release_lock@Base @SVER@
PyThread_set_key_value@Base @SVER@
Reply to: