summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Vu-Brugier <christophe.vu-brugier@seagate.com>2023-10-09 21:47:50 +0200
committerKhem Raj <raj.khem@gmail.com>2023-10-09 13:06:47 -0700
commit8930d8798b44f538fcfb2013cf273c4534778404 (patch)
tree511d27121f195bf04ce63b1faa52bf38c50ddd9c
parent6ee4a15ce28b7f09fa80aad05276ad347a182cbd (diff)
downloadmeta-openembedded-8930d8798b44f538fcfb2013cf273c4534778404.tar.gz
libnvme: apply patch already upstream to fix build with musl
Build failure with musl due to conflicting definitions of ioctl() between glibc and musl has been fixed by libnvme developers with this commit: * https://github.com/linux-nvme/libnvme/commit/ca47ba3119365eafac0ab25a86cab9d9a1b29bd4 Signed-off-by: Christophe Vu-Brugier <christophe.vu-brugier@seagate.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-support/libnvme/libnvme/0001-ioctl-Check-for-ioctl-signature-for-musl.patch38
-rw-r--r--meta-oe/recipes-support/libnvme/libnvme/0001-test-handle-POSIX-ioctl-prototype.patch68
-rw-r--r--meta-oe/recipes-support/libnvme/libnvme_1.6.bb2
3 files changed, 69 insertions, 39 deletions
diff --git a/meta-oe/recipes-support/libnvme/libnvme/0001-ioctl-Check-for-ioctl-signature-for-musl.patch b/meta-oe/recipes-support/libnvme/libnvme/0001-ioctl-Check-for-ioctl-signature-for-musl.patch
deleted file mode 100644
index 06f7b57121..0000000000
--- a/meta-oe/recipes-support/libnvme/libnvme/0001-ioctl-Check-for-ioctl-signature-for-musl.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From ad1ac4215f051bd42b7ddf64dad63d8215cc3ac4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 7 Oct 2023 17:50:54 -0700
4Subject: [PATCH] ioctl: Check for ioctl signature for musl
5
6Fixes
7../git/test/ioctl/mock.c:117:5: error: conflicting types for 'ioctl'
8 117 | int ioctl(int fd, unsigned long request, ...)
9 | ^
10/mnt/b/yoe/master/build/tmp/work/cortexa15t2hf-neon-yoe-linux-musleabi/libnvme/1.6/recipe-sysroot/usr/include/sys/ioctl.h:115:5: note: previous declaration is here
11 115 | int ioctl (int, int, ...);
12 | ^
13
14Upstream-Status: Pending
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 test/ioctl/mock.c | 4 ++++
18 1 file changed, 4 insertions(+)
19
20diff --git a/test/ioctl/mock.c b/test/ioctl/mock.c
21index e917244..7d5c983 100644
22--- a/test/ioctl/mock.c
23+++ b/test/ioctl/mock.c
24@@ -114,7 +114,11 @@ void end_mock_cmds(void)
25 } \
26 })
27
28+#if defined(__linux__) && !defined(__GLIBC__)
29+int ioctl(int fd, int request, ...)
30+#else
31 int ioctl(int fd, unsigned long request, ...)
32+#endif
33 {
34 struct mock_cmds *mock_cmds;
35 bool result64;
36--
372.42.0
38
diff --git a/meta-oe/recipes-support/libnvme/libnvme/0001-test-handle-POSIX-ioctl-prototype.patch b/meta-oe/recipes-support/libnvme/libnvme/0001-test-handle-POSIX-ioctl-prototype.patch
new file mode 100644
index 0000000000..ef9cc47d25
--- /dev/null
+++ b/meta-oe/recipes-support/libnvme/libnvme/0001-test-handle-POSIX-ioctl-prototype.patch
@@ -0,0 +1,68 @@
1From ca47ba3119365eafac0ab25a86cab9d9a1b29bd4 Mon Sep 17 00:00:00 2001
2From: Sam James <sam@gentoo.org>
3Date: Sat, 30 Sep 2023 06:38:53 +0100
4Subject: [PATCH] test: handle POSIX ioctl prototype
5
6glibc has the following prototype for ioctl: int ioctl(int fd, unsigned long request, ...)
7POSIX (inc. musl) has the following for ioctl: int ioctl(int fd, int request, ...)
8
9Check which prototype is used in <sys/ioctl.h> to avoid a conflict and conditionally
10define the right one for the system.
11
12Bug: https://bugs.gentoo.org/914921
13Signed-off-by: Sam James <sam@gentoo.org>
14Upstream-Status: Backport [https://github.com/linux-nvme/libnvme/commit/ca47ba3119365eafac0ab25a86cab9d9a1b29bd4]
15---
16 meson.build | 10 ++++++++++
17 test/ioctl/mock.c | 6 +++++-
18 2 files changed, 15 insertions(+), 1 deletion(-)
19
20diff --git a/meson.build b/meson.build
21index 6fcf1da..2c979cc 100644
22--- a/meson.build
23+++ b/meson.build
24@@ -230,6 +230,16 @@ conf.set(
25 ),
26 description: 'Is network address and service translation available'
27 )
28+conf.set(
29+ 'HAVE_GLIBC_IOCTL',
30+ cc.compiles(
31+ '''#include <sys/ioctl.h>
32+ int ioctl(int fd, unsigned long request, ...);
33+ ''',
34+ name: 'ioctl has glibc-style prototype'
35+ ),
36+ description: 'Is ioctl the glibc interface (rather than POSIX)'
37+)
38
39 if cc.has_function_attribute('fallthrough')
40 conf.set('fallthrough', '__attribute__((__fallthrough__))')
41diff --git a/test/ioctl/mock.c b/test/ioctl/mock.c
42index e917244..5d2ac94 100644
43--- a/test/ioctl/mock.c
44+++ b/test/ioctl/mock.c
45@@ -114,7 +114,11 @@ void end_mock_cmds(void)
46 } \
47 })
48
49+#ifdef HAVE_GLIBC_IOCTL
50 int ioctl(int fd, unsigned long request, ...)
51+#else
52+int ioctl(int fd, int request, ...)
53+#endif
54 {
55 struct mock_cmds *mock_cmds;
56 bool result64;
57@@ -141,7 +145,7 @@ int ioctl(int fd, unsigned long request, ...)
58 result64 = true;
59 break;
60 default:
61- fail("unexpected %s %lu", __func__, request);
62+ fail("unexpected %s %lu", __func__, (unsigned long) request);
63 }
64 check(mock_cmds->remaining_cmds,
65 "unexpected %s command", mock_cmds->name);
66--
672.40.1
68
diff --git a/meta-oe/recipes-support/libnvme/libnvme_1.6.bb b/meta-oe/recipes-support/libnvme/libnvme_1.6.bb
index 26ad36d7d0..802edac508 100644
--- a/meta-oe/recipes-support/libnvme/libnvme_1.6.bb
+++ b/meta-oe/recipes-support/libnvme/libnvme_1.6.bb
@@ -14,7 +14,7 @@ DEPENDS = "json-c"
14SRCREV = "37a803cf77e224f66d86b1e1d9e74a15f55ea600" 14SRCREV = "37a803cf77e224f66d86b1e1d9e74a15f55ea600"
15 15
16SRC_URI = "git://github.com/linux-nvme/libnvme;protocol=https;branch=master \ 16SRC_URI = "git://github.com/linux-nvme/libnvme;protocol=https;branch=master \
17 file://0001-ioctl-Check-for-ioctl-signature-for-musl.patch \ 17 file://0001-test-handle-POSIX-ioctl-prototype.patch \
18" 18"
19 19
20S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"