Skip to contentSkip to conversation

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

PATCH Superseded Thibaut Collet 2 participants 5 messages Sep 28 – Sep 29

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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

As Buildroot is not an old distribution and always provides the uapi linux files, the lldpd ones are removed at the post patch step to have a consistent set of uapi include files.

---
 package/lldpd/lldpd.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/lldpd/lldpd.mk +5 -0
index f0cbc7e436..b6811ce3a8 100644
@@ -61,6 +61,11 @@ else
 LLDPD_CONF_OPTS += --without-readline
 endif
 
+define LLDPD_DROP_UAPI_FILES
+	rm -rf $(@D)/include/linux
+endef
+LLDPD_POST_PATCH_HOOKS += LLDPD_DROP_UAPI_FILES
+
 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 v1 1/1
#1 lore raw

Hi Thibaut,

package/lldpd/lldpd.mk else · line 67

Quoted 4 lines
package/lldpd/lldpd.mk +4 -0
+define LLDPD_DROP_UAPI_FILES
+	rm -rf $(@D)/include/linux
+endef
+LLDPD_POST_PATCH_HOOKS += LLDPD_DROP_UAPI_FILES

LGTM so it'll support the current package versions. However, could the lldpd's build framework be updated too with a mean to avoid such patch ?

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

#2 lore raw
In reply to Thibaut Collet

Hello Thibault,

Quoted 17 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
Quoted 5 lines

As Buildroot is not an old distribution and always provides the uapi linux files, the lldpd ones are removed at the post patch step to have a consistent set of uapi include files.

Thanks for the patch!

However, when you say "Buildroot is not an old distribution and always provides the uapi linux files": we do allow building with fairly old kernels. So which version of the kernel header does lldpd now requires after your change? I'm interested to understand what is the chance of this patch breaking some other users that are running old kernels.

Thanks for your feedback!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Hi Thomas and Vincent,

Thanks for your feedbacks.

Quoted 33 lines · Thomas Petazzoni

Hello Thibault,

Quoted 9 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,

Quoted 1 line

from

../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/signal.h:301,

Quoted 1 line

from

../../../../host/aarch64-buildroot-linux-gnu/sysroot/usr/include/sys/param.h:28,

Quoted 2 lines

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'?

Quoted 9 lines
     81 |         __u128 vregs[32];
        |         ^~~~~~
        |         __u32

As Buildroot is not an old distribution and always provides the uapi linux files, the lldpd ones are removed at the post patch step to have a consistent set of uapi include files.

Thanks for the patch!

Quoted 8 lines

However, when you say "Buildroot is not an old distribution and always provides the uapi linux files": we do allow building with fairly old kernels. So which version of the kernel header does lldpd now requires after your change? I'm interested to understand what is the chance of this patch breaking some other users that are running old kernels.

Thanks for your feedback!

I have done some archeology on lldpd project.
- The linux include has been added to fix outdated kernel header (version 3.6.9) on some distributions, see commit
https://github.com/lldpd/lldpd/commit/2516cfb1d6d474d41cd7effa8d2372fb44939649.
The solution is similar as the one of iproute2
- The header files have been moved to version 4.19 later (see commit
https://github.com/lldpd/lldpd/commit/a192a2e91f8109bd56519563a41bb72ce9cf9b36
)
- These included files create a compilation issue with FreeBSD14 (see
https://github.com/lldpd/lldpd/pull/503/) and remove (see commt
https://github.com/lldpd/lldpd/commit/4da5d52856e150bbc4c3266780dd73d39dfb1898
)
- This removal causes some issue with other distribution (like Debian8) and some files have been re-added (see commit
https://github.com/lldpd/lldpd/commit/2f2ae98ded0c20b049d385e4fa702365eb444ad8
)

So removing the uapi include files of lldpd to use the kernel ones is the best choice for kernel greater or equal to 4.19 to avoid using outdated include files regarding the kernel version.
Gating the LLDPD_POST_PATCH_HOOKS with 'ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_19),y)' will do the job. Do you agree with this solution ?

Regarding Vincent question:

Quoted 1 line

However, could the lldpd's build framework be updated too with a mean to

avoid such patch ?

As spotted in the commit log of lldpd use the right header files to be compliant with any kernel version and distribution is an endless loop. For buildroot rather than relying on modifications inside the lldpd project it can be simpler and faster to just remove them. NB for iproute2 that also provides some uapi include files the compilation is OK for kernel 7.3 with aarch64 as the provided types.h is more recent and __u128 is defined.

Best regards

Thibaut

Quoted 7 lines

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

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

#4 lore raw

Hi Thibaut,

Quoted 6 lines

So removing the uapi include files of lldpd to use the kernel ones is the best choice for kernel greater or equal to 4.19 to avoid using outdated include files regarding the kernel version.
Gating the LLDPD_POST_PATCH_HOOKS with 'ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_19),y)' will do the job. Do you agree with this solution ?

It seems to be a better approach for me.

Quoted 4 lines

Regarding Vincent question:

Quoted 1 line

However, could the lldpd's build framework be updated too with a mean to

Quoted 8 lines

avoid such patch ?

As spotted in the commit log of lldpd use the right header files to be compliant with any kernel version and distribution is an endless loop. For buildroot rather than relying on modifications inside the lldpd project it can be simpler and faster to just remove them. NB for iproute2 that also provides some uapi include files the compilation is OK for kernel 7.3 with aarch64 as the provided types.h is more recent and __u128 is defined.

ok, right, same issue.

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