Skip to contentSkip to conversation

package/btrfs-progs: fix musl build

PATCH Applied Fabrice Fontaine 2 participants 2 messages Jan 10, 2022 – Jan 11, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/btrfs-progs: fix musl build

Fix the following musl build failure raised since bump to version 5.15.1 in commit 20181c3f1b7191d2b6a1b78bfbe32c1f58e87359:

In file included from /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/linux/kernel.h:4,

                 from ./kerncompat.h:31,
                 from common/utils.c:42:
/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/linux/sysinfo.h:7:8: error: redefinition of 'struct sysinfo'
    7 | struct sysinfo {
      |        ^~~~~~~
In file included from common/utils.c:27:
/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/sys/sysinfo.h:10:8: note: originally defined here
   10 | struct sysinfo {
      |        ^~~~~~~

Fixes:
- http://autobuild.buildroot.org/results/16f44fb9dea72a7079e8e5517e760dd79d2724cc

---
 ...nst-h-to-fix-build-with-5-12-headers.patch | 43 ++++++++++++++++
 ...-sys-sysinfo-h-conditionally-on-musl.patch | 49 +++++++++++++++++++
 2 files changed, 92 insertions(+)
 create mode 100644 package/btrfs-progs/0001-btrfs-progs-include-linux-const-h-to-fix-build-with-5-12-headers.patch
 create mode 100644 package/btrfs-progs/0002-btrfs-progs-include-sys-sysinfo-h-conditionally-on-musl.patch
package/btrfs-progs/0001-btrfs-progs-include-linux-const-h-to-fix-build-with-5-12-headers.patch new file +43 -0
new file mode 100644
index 0000000000..b6c1a42456
@@ -0,0 +1,43 @@
+From b28f7bd9bba6f65258da48955154794f466b4104 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Thu, 30 Dec 2021 15:23:59 +0200
+Subject: [PATCH] btrfs-progs: include linux/const.h to fix build with 5.12+
+ headers
+
+btrfs-tools compile fails with mips, musl and 5.12+ headers.
+
+The definition of __ALIGN_KERNEL has moved in 5.12+ kernels, so we
+add an explicit include of const.h to pickup the macro:
+
+  | make: *** [Makefile:595: mkfs.btrfs] Error 1
+  | make: *** Waiting for unfinished jobs....
+  | libbtrfs.a(volumes.o): in function `dev_extent_search_start':
+  | /usr/src/debug/btrfs-tools/5.12.1-r0/git/kernel-shared/volumes.c:464: undefined reference to `__ALIGN_KERNEL'
+  | collect2: error: ld returned 1 exit status
+
+This is safe for older kernel's as well, since the header still
+exists, and is valid to include.
+
+Signed-off-by: Bruce Ashfield <[email protected]>
+[remove invalid OE Upstream-status]
+Signed-off-by: Stijn Tintel <[email protected]>
+Signed-off-by: David Sterba <[email protected]>
+[Retrieved from:
+https://github.com/kdave/btrfs-progs/commit/b28f7bd9bba6f65258da48955154794f466b4104]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ kerncompat.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/kerncompat.h b/kerncompat.h
+index df167fe6c..2503d1afa 100644
+--- a/kerncompat.h
++++ b/kerncompat.h
+@@ -29,6 +29,7 @@
+ #include <stddef.h>
+ #include <linux/types.h>
+ #include <linux/kernel.h>
++#include <linux/const.h>
+ #include <stdint.h>
+ 
+ #include <features.h>
package/btrfs-progs/0002-btrfs-progs-include-sys-sysinfo-h-conditionally-on-musl.patch new file +49 -0

49 lines not on this page · raw message

Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 17 lines · On Mon, 10 Jan 2022 23:52:00 +0100 Fabrice Fontaine…

Fix the following musl build failure raised since bump to version 5.15.1 in commit 20181c3f1b7191d2b6a1b78bfbe32c1f58e87359:

In file included from /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/linux/kernel.h:4,

                 from ./kerncompat.h:31,
                 from common/utils.c:42:
/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/linux/sysinfo.h:7:8: error: redefinition of 'struct sysinfo'
    7 | struct sysinfo {
      |        ^~~~~~~
In file included from common/utils.c:27:
/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/host/i586-buildroot-linux-musl/sysroot/usr/include/sys/sysinfo.h:10:8: note: originally defined here
   10 | struct sysinfo {
      |        ^~~~~~~

Fixes:
- http://autobuild.buildroot.org/results/16f44fb9dea72a7079e8e5517e760dd79d2724cc

Quoted 7 lines
---
 ...nst-h-to-fix-build-with-5-12-headers.patch | 43 ++++++++++++++++
 ...-sys-sysinfo-h-conditionally-on-musl.patch | 49 +++++++++++++++++++
 2 files changed, 92 insertions(+)
 create mode 100644 package/btrfs-progs/0001-btrfs-progs-include-linux-const-h-to-fix-build-with-5-12-headers.patch
 create mode 100644 package/btrfs-progs/0002-btrfs-progs-include-sys-sysinfo-h-conditionally-on-musl.patch

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot