Package: gnunet-fuse
Version: 0.15.0-1
Severity: serious
Tags: patch experimental
Justification: FTBFS
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu kinetic ubuntu-patch

Hi Daniel,

gnunet-fuse is failing to build from source in Ubuntu, because Ubuntu has
updated to glibc 2.34 where pthread_mutexattr_setkind_np has been dropped:

[...]
gcc  -fno-strict-aliasing -Wall -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. 
-flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects 
-fstack-protector-strong -Wformat -Werror=format-security   
-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro 
-o gnunet-fuse gnunet_fuse-gnunet-fuse.o gnunet_fuse-gfs_download.o 
gnunet_fuse-mutex.o gnunet_fuse-readdir.o gnunet_fuse-read.o gnunet_fuse-open.o 
gnunet_fuse-getattr.o -lgnunetutil -lfuse -lgnunetfs  -lgnunetutil -lpthread 
/usr/bin/ld: /tmp/cclaLsKU.ltrans0.ltrans.o: in function 
`GNUNET_FUSE_path_info_create':
./src/fuse/mutex.c:71: undefined reference to `pthread_mutexattr_setkind_np'
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:463: gnunet-fuse] Error 1
[...]

  (https://launchpad.net/ubuntu/+source/gnunet-fuse/0.15.0-1/+build/23574025)

This will affect the package in Debian as well once glibc is updated in
unstable to 2.34 or later (currently, 2.34 is only in experimental).

gnunet-fuse already supports the more standard pthread_mutexattr_settype()
interface, but doesn't use it on Linux platforms.  I've uploaded the
attached patch to Ubuntu which switches it to use the standard interface
everywhere.

Thanks for considering,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru gnunet-fuse-0.15.0/debian/patches/glibc-2.34-compat.patch 
gnunet-fuse-0.15.0/debian/patches/glibc-2.34-compat.patch
--- gnunet-fuse-0.15.0/debian/patches/glibc-2.34-compat.patch   1969-12-31 
16:00:00.000000000 -0800
+++ gnunet-fuse-0.15.0/debian/patches/glibc-2.34-compat.patch   2022-07-06 
19:51:20.000000000 -0700
@@ -0,0 +1,54 @@
+Description: replace mutexattr_setkind_np with standard mutexattr_settype
+ pthread_muteaxttr_settype() has been supported since at least glibc 2.19,
+ and pthread_mutexattr_setkind_np() is no longer supported as of glibc 2.34.
+ Use the standard interface.
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Forwarded: no
+Last-Update: 2022-07-06
+
+Index: gnunet-fuse-0.15.0/src/fuse/mutex.c
+===================================================================
+--- gnunet-fuse-0.15.0.orig/src/fuse/mutex.c
++++ gnunet-fuse-0.15.0/src/fuse/mutex.c
+@@ -36,17 +36,6 @@
+ #endif
+ 
+ /**
+- * This prototype is somehow missing in various Linux pthread
+- * include files. But we need it and it seems to be available
+- * on all pthread-systems so far. Odd.
+- */
+-#ifndef _MSC_VER
+-extern int pthread_mutexattr_setkind_np (pthread_mutexattr_t * attr,
+-                                         int kind);
+-#endif
+-
+-
+-/**
+  * @brief Structure for MUTual EXclusion (Mutex).
+  */
+ struct GNUNET_Mutex
+@@ -67,23 +56,13 @@
+   pthread_mutexattr_init (&attr);
+   if (isRecursive)
+     {
+-#ifdef __linux__
+-      GNUNET_assert (0 == pthread_mutexattr_setkind_np
+-                   (&attr, PTHREAD_MUTEX_RECURSIVE_NP));
+-#elif BSD || SOLARIS || OSX || WINDOWS
+       GNUNET_assert (0 == pthread_mutexattr_settype
+                    (&attr, PTHREAD_MUTEX_RECURSIVE));
+-#endif
+     }
+   else
+     {
+-#ifdef __linux__
+-      GNUNET_assert (0 == pthread_mutexattr_setkind_np
+-                   (&attr, PTHREAD_MUTEX_ERRORCHECK_NP));
+-#else
+       GNUNET_assert (0 == pthread_mutexattr_settype
+                    (&attr, PTHREAD_MUTEX_ERRORCHECK));
+-#endif
+     }
+   mut = GNUNET_new (struct GNUNET_Mutex);
+   GNUNET_assert (0 == pthread_mutex_init (&mut->pt, &attr));
diff -Nru gnunet-fuse-0.15.0/debian/patches/series 
gnunet-fuse-0.15.0/debian/patches/series
--- gnunet-fuse-0.15.0/debian/patches/series    1969-12-31 16:00:00.000000000 
-0800
+++ gnunet-fuse-0.15.0/debian/patches/series    2022-07-06 19:46:30.000000000 
-0700
@@ -0,0 +1 @@
+glibc-2.34-compat.patch

Reply via email to