[OE-core] [PATCH 2/2] grub2: fix build with gcc-7

Khem Raj raj.khem at gmail.com
Mon Aug 21 23:52:26 UTC 2017


On Mon, Aug 21, 2017 at 1:57 PM, Martin Jansa <martin.jansa at gmail.com> wrote:
> * build with gcc-7 fails with:
>   | ./config-util.h:1504:48: error: this use of "defined" may not be   portable [-Werror=expansion-to-defined]
>   |              || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
>   |
                                            ^~~~~~~~~~~~~~~
>   and we're not building on Apple or BSD, so we should be able
>   to just ignoreit until it's resolved properly in some newer gnulib
>   and imported from gnulib to grub-2
>
> Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
> ---
>  meta/recipes-bsp/grub/grub-efi_2.02.bb | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/meta/recipes-bsp/grub/grub-efi_2.02.bb b/meta/recipes-bsp/grub/grub-efi_2.02.bb
> index b949bebced..45f4c1ed34 100644
> --- a/meta/recipes-bsp/grub/grub-efi_2.02.bb
> +++ b/meta/recipes-bsp/grub/grub-efi_2.02.bb
> @@ -36,6 +36,12 @@ EXTRA_OECONF += "--enable-efiemu=no"
>  # and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo)
>  CFLAGS_append_class-native = " -Wno-error=trampolines"
>
> +# this comes from gnulib and it's used only for Apple and BSD, so we can ignore it
> +# ./config-util.h:1504:48: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
> +#             || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
> +#                                                ^~~~~~~~~~~~~~~
> +CFLAGS_append_class-native = " -Wno-error=expansion-to-defined"
> +

This workaround seems reasonable but I wonder why it fails on build host
for you. how is your build hosts toolchain configured to generate this
warning. Since you mentioned gcc7 then why doesnt it fail for OE
targets
in same way.

An upstreamable fix would be to break this define into another #if ..
#else macros and define the new macro to 1 or 0 depending upon the
conditions
being tested.

>  do_install_class-native() {
>         install -d ${D}${bindir}
>         install -m 755 grub-mkimage ${D}${bindir}
> --
> 2.14.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



More information about the Openembedded-core mailing list