Skip to contentSkip to conversation

btrfs-tools: include linux/const.h to fix build with 5.12+ headers

PATCH In review Bruce Ashfield 2 participants 3 messages Jun 18, 2021 – Jun 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-tools: include linux/const.h to fix build with 5.12+ headers

From: Bruce Ashfield <[email protected]>

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 kernels as well, since the header still exists, and is valid to include.

---

I've started a discussion if this is required upstream, but didn't want to wait on sending this.

I'm working on the update to libc-headers 5.13+ and ran into this build error .. only on musl and mips64. Which is why there is hesitation on if this is needed upstream.

Cheers,

Bruce

 ...ude-linux-const.h-to-fix-build-with-.patch | 42 +++++++++++++++++++
 .../btrfs-tools/btrfs-tools_5.12.1.bb         |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch
meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch new file +42 -0
new file mode 100644
index 0000000000..d7188881da
@@ -0,0 +1,42 @@
+From 3d19b0fb882c5e195362a9f0909c474e60070ca0 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Fri, 18 Jun 2021 11:10:36 -0400
+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.
+
+Upstream-status: OE Specific [mips64 + musl + libc-headers]
+
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ kerncompat.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/kerncompat.h b/kerncompat.h
+index df167fe6..254235bd 100644
+--- a/kerncompat.h
++++ b/kerncompat.h
+@@ -30,6 +30,7 @@
+ #include <linux/types.h>
+ #include <linux/kernel.h>
+ #include <stdint.h>
++#include <linux/const.h>
+ 
+ #include <features.h>
+ 
+-- 
+2.25.1
+
meta/recipes-devtools/btrfs-tools/btrfs-tools_5.12.1.bb +1 -0
index 3fc959bf8e..d0c9cf2a99 100644
@@ -18,6 +18,7 @@ DEPENDS_append_class-target = " udev"
 
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git \
            file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \
+           file://0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch \
            "
 SRCREV = "96d77fcefdd3b9fd297b5aabbce6dc43e2315ee2"
 S = "${WORKDIR}/git"
Signature · 1 line
2.19.1
#1 lore raw
Quoted 54 lines · Bruce Ashfield

From: Bruce Ashfield <[email protected]>

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 kernels as well, since the header still exists, and is valid to include.

---

I've started a discussion if this is required upstream, but didn't want to wait on sending this.

I'm working on the update to libc-headers 5.13+ and ran into this build error .. only on musl and mips64. Which is why there is hesitation on if this is needed upstream.

Cheers,

Bruce

 ...ude-linux-const.h-to-fix-build-with-.patch | 42 +++++++++++++++++++
 .../btrfs-tools/btrfs-tools_5.12.1.bb         |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch
meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch new file +11 -0
new file mode 100644
index 0000000000..d7188881da
@@ -0,0 +1,42 @@
+From 3d19b0fb882c5e195362a9f0909c474e60070ca0 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Fri, 18 Jun 2021 11:10:36 -0400
+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:
+

meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch line 21

Quoted 10 lines
meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch new file +10 -0
+  | 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.
+
+Upstream-status: OE Specific [mips64 + musl + libc-headers]

I think it's not specific to musl or mips64 or OE, it should be worth upstreaming to btrfs-tools.

Quoted 39 lines
meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch new file +21 -0
+
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ kerncompat.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/kerncompat.h b/kerncompat.h
+index df167fe6..254235bd 100644
+--- a/kerncompat.h
++++ b/kerncompat.h
+@@ -30,6 +30,7 @@
+ #include <linux/types.h>
+ #include <linux/kernel.h>
+ #include <stdint.h>
++#include <linux/const.h>
+
+ #include <features.h>
+
+--
+2.25.1
+
meta/recipes-devtools/btrfs-tools/btrfs-tools_5.12.1.bb +1 -1
index 3fc959bf8e..d0c9cf2a99 100644
@@ -18,6 +18,7 @@ DEPENDS_append_class-target = " udev"
 
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git \
            file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \
+           file://0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch \
            "
 SRCREV = "96d77fcefdd3b9fd297b5aabbce6dc43e2315ee2"
 S = "${WORKDIR}/git"
--

2.19.1

#2 lore raw
Quoted 62 lines · Khem Raj
Quoted 59 lines · Bruce Ashfield

From: Bruce Ashfield <[email protected]>

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 kernels as well, since the header still exists, and is valid to include.

---

I've started a discussion if this is required upstream, but didn't want to wait on sending this.

I'm working on the update to libc-headers 5.13+ and ran into this build error .. only on musl and mips64. Which is why there is hesitation on if this is needed upstream.

Cheers,

Bruce

 ...ude-linux-const.h-to-fix-build-with-.patch | 42 +++++++++++++++++++
 .../btrfs-tools/btrfs-tools_5.12.1.bb         |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch
meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch new file +16 -0
new file mode 100644
index 0000000000..d7188881da
@@ -0,0 +1,42 @@
+From 3d19b0fb882c5e195362a9f0909c474e60070ca0 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <[email protected]>
+Date: Fri, 18 Jun 2021 11:10:36 -0400
+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
Quoted 8 lines

meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch line 21

Quoted 5 lines
meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch new file +5 -0
+
+This is safe for older kernel's as well, since the header still
+exists, and is valid to include.
+
+Upstream-status: OE Specific [mips64 + musl + libc-headers]

I think it's not specific to musl or mips64 or OE, it should be worth upstreaming to btrfs-tools.

The build error says otherwise. It quite literally only breaks on musl and mips64 with the updated libc-headers, but I didn't dig into how or why the other arches and glibc aren't hitting the error, so who knows :D

But yes, as I mentioned, I will send it upstream after a bit more soaking.

Bruce

Quoted 40 lines
Quoted 40 lines
meta/recipes-devtools/btrfs-tools/btrfs-tools/0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch new file +21 -0
+
+Signed-off-by: Bruce Ashfield <[email protected]>
+---
+ kerncompat.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/kerncompat.h b/kerncompat.h
+index df167fe6..254235bd 100644
+--- a/kerncompat.h
++++ b/kerncompat.h
+@@ -30,6 +30,7 @@
+ #include <linux/types.h>
+ #include <linux/kernel.h>
+ #include <stdint.h>
++#include <linux/const.h>
+
+ #include <features.h>
+
+--
+2.25.1
+
meta/recipes-devtools/btrfs-tools/btrfs-tools_5.12.1.bb +1 -1
index 3fc959bf8e..d0c9cf2a99 100644
@@ -18,6 +18,7 @@ DEPENDS_append_class-target = " udev"
 
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git \
            file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \
+           file://0001-btrfs-tools-include-linux-const.h-to-fix-build-with-.patch \
            "
 SRCREV = "96d77fcefdd3b9fd297b5aabbce6dc43e2315ee2"
 S = "${WORKDIR}/git"
--

2.19.1

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II