[Buildroot] gmp.h error compiling Linux 5.11 with Buildroot 2021.02 default arm toolchain

Michael Opdenacker michael.opdenacker at bootlin.com
Wed Mar 24 14:54:12 UTC 2021

Hi Thomas

Thanks for your help!

On 3/24/21 3:12 PM, Thomas Petazzoni wrote:
> On Wed, 24 Mar 2021 14:47:28 +0100
> Michael Opdenacker <michael.opdenacker at bootlin.com> wrote:
>> On 3/24/21 10:50 AM, Thomas Petazzoni wrote:
>>> Do you have a Buildroot configuration that uses an internal toolchain +
>>> a Linux kernel built by Buildroot, that reproduces this? Or does it
>>> only happens with an external toolchain and/or when you build the
>>> kernel outside of Buildroot?  
>> Actually, the compile job succeeds with the "omap2plus" configuration
>> when the 5.11 kernel is built by Buildroot. Good guess.
>> What doesn't work is building the kernel outside Buildroot with (the
>> Buildroot toolchain from output/host/ or the latest ARM 32 GNU toolchain).
>> Does this help?
> It doesn't help per-se, but it's another useful data point. This whole
> gmp.h is due to the gcc plugins that the kernel is building.
> The gcc plugin causing issue there is built when
> CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK=y in your kernel configuration.
> Could you double check you have that enabled both when building the
> kernel within Buildroot, and outside of Buildroot ?

Indeed, when compiling the kernel from outside of Buildroot is breaking,
CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK is set,and if I disable this option,
the kernel builds fine. The kernel built by Buildroot internally didn't
have this flag.

What was unexpected for me is that this option is set by "make
omap2plus_defconfig" depending on your CROSS_COMPILE setting. With
arm-linux-gnueabi-gcc package by Ubuntu, you don't have it, but you do
have it with the Buildroot or ARM toolchain. It's because it depends on
a test for gcc plugins (see
and https://elixir.bootlin.com/linux/latest/K/ident/CONFIG_GCC_PLUGINS)

> To me, it seems like passing
> HOSTCXXFLAGS=-I/path/to/buildroot/output/host/include when building
> the kernel should get you passed the issue when building the kernel
> externally.

Right, I confirm this works. Thanks!

> And it probably works when Buildroot builds the kernel, because we're
> passing:
> when building the kernel, so the kernel build system does invoke the
> native gcc with the appropriate -I option pointing to
> $(HOST_DIR)/include.

Good to know, thanks! Is there anything that should be changed in the
Linux build system or in our toolchains ?

Anyway, thanks for documenting this behavior.


Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering

More information about the buildroot mailing list