Sample Header Ad - 728x90

Which GCC version to use for compiling Linux 5.4.1 to bzImage without strlcpy errors?

0 votes
1 answer
62 views
I’m trying to compile the Linux 5.4.1 kernel to a bzImage using an older GCC version I built from source (gcc 8.2.0 and binutils 2.31.1), with:
make CC= LD= -j$(nproc)
However, I get errors about a redundant declaration of strlcpy. Which GCC version should I use to compile this kernel version without errors, so I can test the system calls I just created? I have specific requirements to work with this kernel. update: actually i do not know why it counts my system headers as well while compiling and finds another declaration of strlcpy in /usr/include...
/home/alexisl/Kernels/linux-5.4.1-mod/tools/include/linux/string.h:20:15: error: redundant redeclaration of ‘strlcpy’ [-Werror=redundant-decls]
   20 | extern size_t strlcpy(char *dest, const char *src, size_t size);
      |               ^~~~~~~
In file included from /home/alexisl/Kernels/linux-5.4.1-mod/tools/include/linux/string.h:6:
/usr/include/string.h:506:15: note: previous declaration of ‘strlcpy’ with type ‘size_t(char * restrict,  const char * restrict,  size_t)’ {aka ‘long unsigned int(char * restrict,  const char * restrict,  long unsigned int)’}
  506 | extern size_t strlcpy (char *__restrict __dest,
so that is why the compilation process fails. how do i isolate it and make it not take into account the system's headers?
Asked by ALEXIS LAZANAS (1 rep)
May 23, 2025, 07:43 PM
Last activity: Jul 6, 2025, 09:59 PM