Description
Building the driver on newer Linux kernels (e.g., 7.2.0-cachyos compiled with Clang/LLVM) fails due to implicit declaration errors for strncpy.
Modern Clang toolchains fail the build when non-declared or deprecated string functions like strncpy are used in kernel code.
Error Output
src/linuwu_sense.c:3574:5: error: call to undeclared library function 'strncpy' with type 'char *(char *, const char *, __size_t)' [-Wimplicit-function-declaration]
3574 | strncpy(input, buf, len);
| ^
src/linuwu_sense.c:4076:5: error: call to undeclared library function 'strncpy' with type 'char *(char *, const char *, __size_t)' [-Wimplicit-function-declaration]
4076 | strncpy(input_buf, buf, len);
| ^
Environment
- OS: CachyOS Linux
- Kernel: 7.2.0-rc6-1-cachyos-rc (or any modern kernel compiled with LLVM/Clang)
- Compiler: Clang / LLVM
Suggested Fix / Workaround
Replacing all occurrences of strncpy with strscpy in src/linuwu_sense.c resolves the build error completely:
sed -i 's/strncpy/strscpy/g' src/linuwu_sense.c
Description
Building the driver on newer Linux kernels (e.g.,
7.2.0-cachyoscompiled with Clang/LLVM) fails due to implicit declaration errors forstrncpy.Modern Clang toolchains fail the build when non-declared or deprecated string functions like
strncpyare used in kernel code.Error Output
Environment
Suggested Fix / Workaround
Replacing all occurrences of
strncpywithstrscpyinsrc/linuwu_sense.cresolves the build error completely:sed -i 's/strncpy/strscpy/g' src/linuwu_sense.c