Linux 4.19 Kernel Now Requires GCC 4.6 to Build, Due to Compiling Failures on Older Architecture

For Linux developers working on the kernel, the to-be-released Linux 4.19 kernel raises the GCC minimum version required for kernel building. The official Linux kernel has listed GCC 3.2 as the minimum version of the compiler required for kernel building, but Linux kernel 4.19 is raising that to GCC 4.6.

This is because various architectures on older GCC4 releases have been failing to cleanly compile the Linux kernel, hence why GCC 4.6 is being set as the minimum. The kernel will also explicitly check for GCC 4.6.0 or newer and if not found, the compiler will error out.

This is also beneficial for the kernel code, as the kernel devs were able to strip out several dozen lines of code for older GCC workarounds that were aimed at compiler bugs and behavioral differences in the older compiler releases.

This change was merged just earlier today via Git commit – and GCC 4.6.0 was released in 2011, so we’ll see if GCC has any updates in the future as well.

The changelog / commit for this update basically specifies that the change is pretty much entirely due to older versions of the GCC compiler failing to build the kernel under various architectures, as noted below:

Various architectures fail to build properly with older versions of the gcc compiler.

An example from Guenter Roeck in thread [1]:
>   In file included from ./include/linux/mm.h:17:0,
>                    from ./include/linux/pid_namespace.h:7,
>                    from ./include/linux/ptrace.h:10,
>                    from arch/openrisc/kernel/asm-offsets.c:32:
>   ./include/linux/mm_types.h:497:16: error: flexible array member in otherwise empty struct
> This is just an example with gcc 4.5.1 for or32. I have seen the problem
> with gcc 4.4 (for unicore32) as well.

So update the minimum required version of gcc to 4.6.


 - Update Documentation/process/changes.rst
 - Remove and consolidate version test blocks in compiler-gcc.h for versions lower than 4.6

As far as LLVM Clang efforts for building the mainline Linux x86_64 kernel, there is currently some stall with the efforts, particularly in the LLVMLinux project – although there’s been some work in building the kernel through the ARM Linux space with Clang.

Kamil Anwar
Kamil is a certified MCITP, CCNA (W), CCNA (S) and a former British Computer Society Member with over 9 years of experience Configuring, Deploying and Managing Switches, Firewalls and Domain Controllers also an old-school still active on FreeNode.