Package: libxsmm Severity: serious Tags: patch ftbfs Justification: fails to build from source (but built successfully in the past) User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu kinetic ubuntu-patch
Dear Maintainer, With glibc >= 2.34, libxsmm FTBFS with an undefined reference to pthread_yield. Fixes have been committed upstream, but not yet included in a release. In Ubuntu, we cherry-picked the upstream commits to fix the build: * debian/patches: Cherry-pick upstream patches to fix undefined reference to pthread_yield (LP: #1984111). Thanks, Nick
diff -Nru libxsmm-1.17/debian/patches/0003-Issue-551-rely-on-sched_yield-rather-than-pthread_yi.patch libxsmm-1.17/debian/patches/0003-Issue-551-rely-on-sched_yield-rather-than-pthread_yi.patch --- libxsmm-1.17/debian/patches/0003-Issue-551-rely-on-sched_yield-rather-than-pthread_yi.patch 1969-12-31 19:00:00.000000000 -0500 +++ libxsmm-1.17/debian/patches/0003-Issue-551-rely-on-sched_yield-rather-than-pthread_yi.patch 2022-08-09 10:18:54.000000000 -0400 @@ -0,0 +1,25 @@ +Description: rely on sched_yield rather than pthread_yield (GLIBC 2.34 and later). +Author: Hans Pabst <hans.pa...@intel.com> +Origin: upstream, https://github.com/libxsmm/libxsmm/commit/161ee78f1ccbbe6ce2c0439d6889221cca77ce13 +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libxsmm/+bug/1984111 +Last-Update: 2022-08-09 +--- + +--- a/include/libxsmm_sync.h ++++ b/include/libxsmm_sync.h +@@ -462,6 +462,10 @@ + # define LIBXSMM_TLS_GETVALUE(KEY) pthread_getspecific(KEY) + # if defined(__APPLE__) && defined(__MACH__) + # define LIBXSMM_SYNC_YIELD pthread_yield_np() ++# elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ ++ && LIBXSMM_VERSION2(2, 34) <= LIBXSMM_VERSION2(__GLIBC__, __GLIBC_MINOR__) ++ LIBXSMM_EXTERN int sched_yield(void); /* sched.h */ ++# define LIBXSMM_SYNC_YIELD sched_yield() + # else + # if defined(__USE_GNU) || !defined(__BSD_VISIBLE) + LIBXSMM_EXTERN int pthread_yield(void) LIBXSMM_THROW; +@@ -813,4 +817,3 @@ + LIBXSMM_API unsigned int libxsmm_get_tid(void); + + #endif /*LIBXSMM_SYNC_H*/ +- diff -Nru libxsmm-1.17/debian/patches/0004-Fixed-potential-issue-about-undefined-pthread_yield.patch libxsmm-1.17/debian/patches/0004-Fixed-potential-issue-about-undefined-pthread_yield.patch --- libxsmm-1.17/debian/patches/0004-Fixed-potential-issue-about-undefined-pthread_yield.patch 1969-12-31 19:00:00.000000000 -0500 +++ libxsmm-1.17/debian/patches/0004-Fixed-potential-issue-about-undefined-pthread_yield.patch 2022-08-09 10:18:54.000000000 -0400 @@ -0,0 +1,33 @@ +Description: Fixed potential issue about undefined pthread_yield (linkage). +Author: Hans Pabst <hans.pa...@intel.com> +Origin: upstream, https://github.com/libxsmm/libxsmm/commit/304de784a56c3d7763c92b1801e059c3d39e14dc +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libxsmm/+bug/1984111 +Last-Update: 2022-08-09 +--- +diff --git a/include/libxsmm_macros.h b/include/libxsmm_macros.h +index 1795ce763..e4d31c9d3 100644 +--- a/include/libxsmm_macros.h ++++ b/include/libxsmm_macros.h +@@ -844,6 +844,7 @@ LIBXSMM_API_INLINE int libxsmm_nonconst_int(int i) { return i; } + # include <windows.h> + # else + # include <pthread.h> ++# include <unistd.h> + # endif + #endif + #if !defined(LIBXSMM_ASSERT) +diff --git a/include/libxsmm_sync.h b/include/libxsmm_sync.h +index b64a55f09..d92dad2c8 100644 +--- a/include/libxsmm_sync.h ++++ b/include/libxsmm_sync.h +@@ -466,8 +466,8 @@ typedef enum libxsmm_atomic_kind { + # define LIBXSMM_TLS_GETVALUE(KEY) pthread_getspecific(KEY) + # if defined(__APPLE__) && defined(__MACH__) + # define LIBXSMM_SYNC_YIELD pthread_yield_np() +-# elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ +- && LIBXSMM_VERSION2(2, 34) <= LIBXSMM_VERSION2(__GLIBC__, __GLIBC_MINOR__) ++# elif defined(_POSIX_PRIORITY_SCHEDULING) || (defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ ++ && LIBXSMM_VERSION2(2, 34) <= LIBXSMM_VERSION2(__GLIBC__, __GLIBC_MINOR__)) + LIBXSMM_EXTERN int sched_yield(void); /* sched.h */ + # define LIBXSMM_SYNC_YIELD sched_yield() + # else diff -Nru libxsmm-1.17/debian/patches/series libxsmm-1.17/debian/patches/series --- libxsmm-1.17/debian/patches/series 2022-03-19 19:49:47.000000000 -0400 +++ libxsmm-1.17/debian/patches/series 2022-08-09 10:18:54.000000000 -0400 @@ -1,2 +1,4 @@ 0001-Makefile-rebuild-fix.patch 0002-Makefile-fix-pkgconfigdir.patch +0003-Issue-551-rely-on-sched_yield-rather-than-pthread_yi.patch +0004-Fixed-potential-issue-about-undefined-pthread_yield.patch