diff mbox series

[1/1] package/libdex: fix musl build with liburing

Message ID 20240725135859.522321-1-fontaine.fabrice@gmail.com
State Superseded
Headers show
Series [1/1] package/libdex: fix musl build with liburing | expand

Commit Message

Fabrice Fontaine July 25, 2024, 1:58 p.m. UTC
Add -D_GNU_SOURCE to CFLAGS as liburing.h doesn't define it anymore
since bump of liburing to version 2.6 in commit
da45ae33040a55d9eaa6a05c75c5e7f24fe73cf4 and
https://github.com/axboe/liburing/commit/c427ed678f39fd144d784f2e970bd8c52f425e14
resulting in the following musl build failure since the addition of
libdex in commit 70319b47f646f74f407ed3355baf5b581a10518a:

In file included from ../src/dex-uring-aio-backend.c:29:
/home/autobuild/autobuild/instance-7/output-1/host/mips-buildroot-linux-musl/sysroot/usr/include/liburing.h:224:39: error: unknown type name 'cpu_set_t'
  224 |                                 const cpu_set_t *mask);
      |                                       ^~~~~~~~~
/home/autobuild/autobuild/instance-7/output-1/host/mips-buildroot-linux-musl/sysroot/usr/include/liburing.h:1212:48: error: unknown type name 'loff_t'; did you mean 'off_t'?
 1212 |                                        int fd, loff_t len)
      |                                                ^~~~~~
      |                                                off_t

Fixes: 70319b47f646f74f407ed3355baf5b581a10518a
 - http://autobuild.buildroot.org/results/276646bf224d5927cf0311cf978571a7f8774116

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/libdex/libdex.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Petazzoni July 25, 2024, 4:26 p.m. UTC | #1
On Thu, 25 Jul 2024 15:58:59 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> +LIBDEX_CFLAGS += $(TARGET_CFLAGS) -D_GNU_SOURCE

You will probably hate me, but I think this is not the right solution.
Indeed, if we adopt this solution then *ALL* packages that use liburing
will have to manually define _GNU_SOURCE.

I am not entirely clear on
whether https://github.com/axboe/liburing/commit/c427ed678f39fd144d784f2e970bd8c52f425e14
is a good idea. It's not clear for me whether the public header of a
library like this is supposed to set the feature macros it requires for
itself, or whether that should be done by the users of the library. The
latter seems really odd to me, to be honest.

At the very least, what I would suggest here is that -D_GNU_SOURCE gets
added to the .pc file of liburing, and this contributed to upstream
liburing. Or maybe -D_XOPEN_SOURCE=500 -D_GNU_SOURCE.

Really, I have no idea what is the correct way of dealing with those
feature macros.

Thomas
diff mbox series

Patch

diff --git a/package/libdex/libdex.mk b/package/libdex/libdex.mk
index 360b389255..9aec1b6dae 100644
--- a/package/libdex/libdex.mk
+++ b/package/libdex/libdex.mk
@@ -30,6 +30,7 @@  endif
 ifeq ($(BR2_PACKAGE_LIBURING),y)
 LIBDEX_CONF_OPTS += -Dliburing=enabled
 LIBDEX_DEPENDENCIES += liburing
+LIBDEX_CFLAGS += $(TARGET_CFLAGS) -D_GNU_SOURCE
 else
 LIBDEX_CONF_OPTS += -Dliburing=disabled
 endif