Bug 16093

Summary: kmod and gcc-14 build error
Product: buildroot Reporter: Lance Fredrickson <lancethepants>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: buildroot, fiona.klute, yann.morin.1998
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Lance Fredrickson 2024-06-04 14:06:07 UTC
Trying out 2024.05-rc1 ran into this issue when using gcc-14. Minimum defconfig below. I saw a patch in patchwork, but it wasn't gcc-14 related and didn't work here when applying it.

libkmod/libkmod-config.c: In function 'conf_files_insert_sorted':
libkmod/libkmod-config.c:797:24: error: implicit declaration of function 'basename' [-Wimplicit-function-declaration]
  797 |                 name = basename(path);
      |                        ^~~~~~~~
libkmod/libkmod-config.c:797:24: warning: nested extern declaration of 'basename' [-Wnested-externs]
libkmod/libkmod-config.c:797:22: error: assignment to 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  797 |                 name = basename(path);
      |                      ^
make[3]: *** [Makefile:1771: libkmod/libkmod-config.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
shared/util.c: In function 'path_to_modname':
shared/util.c:177:19: error: implicit declaration of function 'basename' [-Wimplicit-function-declaration]
  177 |         modname = basename(path);
      |                   ^~~~~~~~
shared/util.c:177:19: warning: nested extern declaration of 'basename' [-Wnested-externs]
shared/util.c:177:17: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  177 |         modname = basename(path);


BR2_x86_64=y
BR2_TOOLCHAIN_BUILDROOT_MUSL=y
BR2_KERNEL_HEADERS_6_6=y
BR2_BINUTILS_VERSION_2_42_X=y
BR2_GCC_VERSION_14_X=y
BR2_PACKAGE_KMOD=y
Comment 1 Fiona Klute 2024-06-04 16:58:33 UTC
I believe that is the same kmod/musl issue that caused a segfault (after "only" warnings during build) with GCC 13. I sent a patch based on an upstream PR in April, unfortunately it hasn't been merged yet. Good thing they upgraded that to an error in GCC. https://patchwork.ozlabs.org/project/buildroot/patch/20240426215144.1107186-1-fiona.klute@gmx.de/
Comment 2 Yann E. MORIN 2024-06-04 19:20:56 UTC
Lance, All,

Thanks for the report.

We believe this issue is now fixed now we applied Fiona's patch:
    https://gitlab.com/buildroot.org/buildroot/-/commit/05617724ee2b5db9a1a6bb07272915ef3c1fd535

If the issue still happens, please re-open and provide more details.

Regards,
Yann E. MORIN.
Comment 3 Lance Fredrickson 2024-06-04 19:50:46 UTC
Working good for me, I realized I originally applied the patch incorrectly. Thanks for the quick turnaround!