Skip to contentSkip to conversation

package/lldpd: fix compilation issue with kernel 7.3 on aarch64

PATCH Applied Thibaut Collet 2 participants 3 messages Sep 30 – Oct 11

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/lldpd: fix compilation issue with kernel 7.3 on aarch64

lldpd bundles some uapi linux files for old distributions, especially the types.h one.

Since kernel commit d4bf9e08d412 ("arm64: uapi: Use __u128 instead of __uint128_t in UAPI headers"), the type __u128 is used by sigcontext.h. This type is defined in types.h, but the old version bundled by lldpd does not provide it. This lack leads to the following compilation error:

In file included from ../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/sigcontext.h:30,

                   from ../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/signal.h:301,
                   from ../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/param.h:28,
                   from privsep_io.c:5:
  ../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/asm/sigcontext.h:81:9: error: unknown type name '__u128'; did you mean '__u32'?
     81 |         __u128 vregs[32];
        |         ^~~~~~
        |         __u32

The uapi linux files bundled by lldpd are the ones of kernel 4.19
(https://github.com/lldpd/lldpd/commit/a192a2e91f81), and they are prepended to the include path, so they shadow the sysroot ones.

Remove them so that lldpd uses the uapi files of the sysroot, but only when the toolchain provides kernel headers 4.19 or later. With older headers the bundled files are kept, so those configurations are left unchanged.

---

Changes v1 -> v2:
- Only remove the bundled headers for kernel headers >= 4.19

 package/lldpd/lldpd.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/lldpd/lldpd.mk +7 -0
index f0cbc7e436..9ecf622b22 100644
@@ -61,6 +61,13 @@ else
 LLDPD_CONF_OPTS += --without-readline
 endif
 
+ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_19),y)
+define LLDPD_DROP_UAPI_FILES
+	rm -rf $(@D)/include/linux
+endef
+LLDPD_POST_PATCH_HOOKS += LLDPD_DROP_UAPI_FILES
+endif
+
 define LLDPD_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 0755 package/lldpd/S60lldpd \
 		$(TARGET_DIR)/etc/init.d/S60lldpd
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Vincent Jardin on v2 1/1
#1 lore raw

Hi Thibaut,

Quoted 11 lines

Changes v1 -> v2:
- Only remove the bundled headers for kernel headers >= 4.19

 package/lldpd/lldpd.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/lldpd/lldpd.mk +0 -0
index f0cbc7e436..9ecf622b22 100644

package/lldpd/lldpd.mk else · line 70

Quoted 10 lines
package/lldpd/lldpd.mk +7 -0
@@ -61,6 +61,13 @@ else
 LLDPD_CONF_OPTS += --without-readline
 endif
 
+ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_19),y)
+define LLDPD_DROP_UAPI_FILES
+	rm -rf $(@D)/include/linux
+endef
+LLDPD_POST_PATCH_HOOKS += LLDPD_DROP_UAPI_FILES
+endif
+

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Thibaut Collet
Quoted 21 lines · Thibaut Collet

lldpd bundles some uapi linux files for old distributions, especially the types.h one.

Since kernel commit d4bf9e08d412 ("arm64: uapi: Use __u128 instead of __uint128_t in UAPI headers"), the type __u128 is used by sigcontext.h. This type is defined in types.h, but the old version bundled by lldpd does not provide it. This lack leads to the following compilation error:

In file included from ../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/bits/sigcontext.h:30,

                   from ../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/signal.h:301,
                   from ../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/param.h:28,
                   from privsep_io.c:5:
  ../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/asm/sigcontext.h:81:9: error: unknown type name '__u128'; did you mean '__u32'?
     81 |         __u128 vregs[32];
        |         ^~~~~~
        |         __u32

The uapi linux files bundled by lldpd are the ones of kernel 4.19
(https://github.com/lldpd/lldpd/commit/a192a2e91f81), and they are prepended to the include path, so they shadow the sysroot ones.

Quoted 6 lines

Remove them so that lldpd uses the uapi files of the sysroot, but only when the toolchain provides kernel headers 4.19 or later. With older headers the bundled files are kept, so those configurations are left unchanged.

Applied to master, thanks!

Regards,
Arnout

Quoted 28 lines

---

Changes v1 -> v2:
- Only remove the bundled headers for kernel headers >= 4.19

 package/lldpd/lldpd.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/lldpd/lldpd.mk +7 -0
index f0cbc7e436..9ecf622b22 100644
@@ -61,6 +61,13 @@ else
 LLDPD_CONF_OPTS += --without-readline
 endif
 
+ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_19),y)
+define LLDPD_DROP_UAPI_FILES
+	rm -rf $(@D)/include/linux
+endef
+LLDPD_POST_PATCH_HOOKS += LLDPD_DROP_UAPI_FILES
+endif
+
 define LLDPD_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 0755 package/lldpd/S60lldpd \
 		$(TARGET_DIR)/etc/init.d/S60lldpd
Signature · 1 line
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot