[yocto] How should we handle GCC 6 and -isystem /usr/include?

Martin Kelly mkelly at xevo.com
Thu Apr 20 17:04:49 PDT 2017


Hi,

After compiling a package with GCC 6, I noticed the following error, 
which is a known issue:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129

The problem is caused by adding -isystem /usr/include, which breaks the 
GCC 6's #include_next. I see that Khem Raj already removed this for the 
nativesdk [1], but it seems we need a similar fix for other packages, as 
we are still adding -isystem in meta/conf/bitbake.conf:

[snip]
BUILDSDK_CPPFLAGS = "-isystem${STAGING_INCDIR}"
[snip]

I experimented with a few options:

- Changing this to "-I${STAGING_INCDIR}". Although this works (and the 
poky repo will recompile with it), I believe it will break when a recipe 
does -Wall -Werror and hits an error in the standard include files 
(-isystem specifically ignores warnings for this reason.)

- Changing this to just "". This breaks at least pbzip2-native, which 
can no longer find bzlib.h, since it uses the system g++ to do so and 
bzlib-dev is not installed.

I'm guessing the right solution involves passing a --sysroot option to 
the native build instead of -isystem so that the builtin gcc/g++ 
/usr/include will find the right files.

Does this sound right, or do you have other ideas?

Thanks,
Martin

[1] poky 54d06c080393785270313878bc4a15a9915571ba
     https://patchwork.openembedded.org/patch/122285/



More information about the yocto mailing list