* [Buildroot] [PATCH] package/libfuse3: fix build failure with no NPTL
@ 2025-04-25 22:31 Giulio Benetti
2025-05-17 10:39 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Giulio Benetti @ 2025-04-25 22:31 UTC (permalink / raw)
To: buildroot; +Cc: Giulio Benetti
Add local patches, one upstreamed and one pending upstream to fix the
presence of function pthread_setname_np in runtime.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
.../0001-Fix-meson-function-tests.patch | 121 ++++++++++++++++++
...ke-special_funcs-check-more-reliable.patch | 41 ++++++
2 files changed, 162 insertions(+)
create mode 100644 package/libfuse3/0001-Fix-meson-function-tests.patch
create mode 100644 package/libfuse3/0002-meson.build-make-special_funcs-check-more-reliable.patch
diff --git a/package/libfuse3/0001-Fix-meson-function-tests.patch b/package/libfuse3/0001-Fix-meson-function-tests.patch
new file mode 100644
index 0000000000..7af9721337
--- /dev/null
+++ b/package/libfuse3/0001-Fix-meson-function-tests.patch
@@ -0,0 +1,121 @@
+From 4840ffe9e8610934d91b27061ff149cc74b41c28 Mon Sep 17 00:00:00 2001
+From: Bernd Schubert <bschubert@ddn.com>
+Date: Thu, 24 Apr 2025 16:49:08 +0200
+Subject: [PATCH] Fix meson function tests
+
+Several meson tests were incorrectly failing
+
+Checking for function "static_assert" : NO (cached)
+Checking for function "pthread_setname_np" : NO (cached)
+Check usable header "#include <linux/close_range.h>" : NO (cached)
+
+These functions get now tested with compilation tests
+and get found on my system.
+
+Checking if "static_assert check" compiles: YES
+Checking if "pthread_setname_np check" compiles: YES
+Checking if "close_range check" compiles: YES
+
+Upstream: https://github.com/libfuse/libfuse/commit/82bcd818fb3e7d5ced9b0c04b7b7a98a892e807e
+Signed-off-by: Bernd Schubert <bschubert@ddn.com>
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ meson.build | 67 +++++++++++++++++++++++++++++++++++++++--------------
+ 1 file changed, 49 insertions(+), 18 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index ba551ed..d1346d0 100644
+--- a/meson.build
++++ b/meson.build
+@@ -59,6 +59,8 @@ include_default = '''
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
++#include <assert.h> /* For static_assert */
++#include <pthread.h> /* For pthread_setname_np */
+ '''
+ args_default = [ '-D_GNU_SOURCE' ]
+
+@@ -72,32 +74,61 @@ private_cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
+ # Test for presence of some functions
+ test_funcs = [ 'fork', 'fstatat', 'openat', 'readlinkat', 'pipe2',
+ 'splice', 'vmsplice', 'posix_fallocate', 'fdatasync',
+- 'utimensat', 'copy_file_range', 'fallocate', 'static_assert',
+- 'pthread_setname_np' ]
++ 'utimensat', 'copy_file_range', 'fallocate' ]
+ foreach func : test_funcs
+ private_cfg.set('HAVE_' + func.to_upper(),
+ cc.has_function(func, prefix: include_default, args: args_default))
+ endforeach
+-private_cfg.set('HAVE_SETXATTR',
+- cc.has_function('setxattr', prefix: '#include <sys/xattr.h>'))
+-private_cfg.set('HAVE_ICONV',
+- cc.has_function('iconv', prefix: '#include <iconv.h>'))
+-private_cfg.set('HAVE_BACKTRACE',
+- cc.has_function('backtrace', prefix: '#include <execinfo.h>'))
+
+-# Test if headers exist
+-private_cfg.set('HAVE_LINUX_CLOSE_RANGE_H',
+- cc.check_header('#include <linux/close_range.h>'))
++# Special case checks that need custom code
++special_funcs = {
++ 'static_assert': '''
++ #include <assert.h>
++ static_assert(1, "test");
++ int main(void) { return 0; }
++ ''',
++ 'pthread_setname_np': '''
++ #include <pthread.h>
++ int main(void) {
++ pthread_t thread = pthread_self();
++ pthread_setname_np(thread, "test");
++ return 0;
++ }
++ ''',
++ 'close_range': '''
++ #include <unistd.h>
++ #include <fcntl.h>
++ #include <linux/close_range.h>
++ int main(void) {
++ unsigned int flags = CLOSE_RANGE_UNSHARE;
++ return close_range(3, ~0U, flags);
++ }
++ '''
++}
++
++foreach name, code : special_funcs
++ private_cfg.set('HAVE_' + name.to_upper(),
++ cc.compiles(code, args: ['-Werror'] + args_default,
++ name: name + ' check'))
++endforeach
++
++# Regular function checks
++private_cfg.set('HAVE_SETXATTR',
++ cc.has_function('setxattr', prefix: '#include <sys/xattr.h>'))
++private_cfg.set('HAVE_ICONV',
++ cc.has_function('iconv', prefix: '#include <iconv.h>'))
++private_cfg.set('HAVE_BACKTRACE',
++ cc.has_function('backtrace', prefix: '#include <execinfo.h>'))
+
+-# Test if structs have specific member
++# Struct member checks
+ private_cfg.set('HAVE_STRUCT_STAT_ST_ATIM',
+- cc.has_member('struct stat', 'st_atim',
+- prefix: include_default,
+- args: args_default))
++ cc.has_member('struct stat', 'st_atim',
++ prefix: include_default + '#include <sys/stat.h>',
++ args: args_default))
+ private_cfg.set('HAVE_STRUCT_STAT_ST_ATIMESPEC',
+- cc.has_member('struct stat', 'st_atimespec',
+- prefix: include_default,
+- args: args_default))
++ cc.has_member('struct stat', 'st_atimespec',
++ prefix: include_default + '#include <sys/stat.h>',
++ args: args_default))
+
+ #
+ # Compiler configuration
+--
+2.39.5
+
diff --git a/package/libfuse3/0002-meson.build-make-special_funcs-check-more-reliable.patch b/package/libfuse3/0002-meson.build-make-special_funcs-check-more-reliable.patch
new file mode 100644
index 0000000000..c39794e62d
--- /dev/null
+++ b/package/libfuse3/0002-meson.build-make-special_funcs-check-more-reliable.patch
@@ -0,0 +1,41 @@
+From 6f50c950d09ad09339437b81ce22b36e0e2749c9 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Fri, 25 Apr 2025 19:00:14 +0200
+Subject: [PATCH] meson.build: make special_funcs check more reliable
+
+Unfortunately while cross-compiling with build tools like Buildroot it
+happens to have repeated flags or anything that could lead to a warning.
+This way the check fails because of a warning not related to the special
+function. So let's use cc.links() and increase minimum meson_version to
+0.60 since cc.links() has been added during that version.
+
+Upstream: https://github.com/libfuse/libfuse/pull/1211
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ meson.build | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index d1346d0..d3d236d 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1,6 +1,6 @@
+ project('libfuse3', ['c'],
+ version: '3.17.2',
+- meson_version: '>= 0.51.0',
++ meson_version: '>= 0.60.0',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'c_std=gnu11',
+@@ -108,7 +108,7 @@ special_funcs = {
+
+ foreach name, code : special_funcs
+ private_cfg.set('HAVE_' + name.to_upper(),
+- cc.compiles(code, args: ['-Werror'] + args_default,
++ cc.links(code, args: args_default,
+ name: name + ' check'))
+ endforeach
+
+--
+2.39.5
+
--
2.39.5
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Buildroot] [PATCH] package/libfuse3: fix build failure with no NPTL
2025-04-25 22:31 [Buildroot] [PATCH] package/libfuse3: fix build failure with no NPTL Giulio Benetti
@ 2025-05-17 10:39 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-05-17 10:39 UTC (permalink / raw)
To: Giulio Benetti; +Cc: buildroot
Hello Giulio,
On Sat, 26 Apr 2025 00:31:40 +0200
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> Add local patches, one upstreamed and one pending upstream to fix the
> presence of function pthread_setname_np in runtime.
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> .../0001-Fix-meson-function-tests.patch | 121 ++++++++++++++++++
> ...ke-special_funcs-check-more-reliable.patch | 41 ++++++
> 2 files changed, 162 insertions(+)
> create mode 100644 package/libfuse3/0001-Fix-meson-function-tests.patch
> create mode 100644 package/libfuse3/0002-meson.build-make-special_funcs-check-more-reliable.patch
Applied to master, thanks. However, I had to improve the commit log
quite a bit, because it was missing two critical information:
- Since when the problem started happening, so that we know if the fix
needs to be backported or not
- Reference to an autobuilder failure
So I ended up with:
package/libfuse3: fix build failure with no NPTL
Since the bump of libfuse3 from 3.16.2 to 3.17.1 in Buildroot commit
a4430578aeb6ca460813f4ff7d833cdd839a3249, libfuse3 uses
pthread_setname_np() which is only available with NPTL.
Some initial fixes were made upstream, but are insufficient to fully
fix the problem, so this commit brings additional upstream patches
fixing the issue completely.
Fixes:
https://autobuild.buildroot.net/results/f3cfaa8ed63483858ffa32b719ea4be68ba6c4f3/
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Also, since your patch has been accepted upstream, I replaced the
Upstream: link to point to the final upstream commit.
Thanks a lot!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-17 10:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-25 22:31 [Buildroot] [PATCH] package/libfuse3: fix build failure with no NPTL Giulio Benetti
2025-05-17 10:39 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox