squashfs: fix build with glibc-2.26
PATCH 1/2 squashfs: fix build with glibc-2.26
--- .../squashfs-tools-4.3-sysmacros.patch | 32 ++++++++++++++++++++++ .../squashfs-tools/squashfs-tools_git.bb | 1 + 2 files changed, 33 insertions(+) create mode 100644 meta/recipes-devtools/squashfs-tools/squashfs-tools/squashfs-tools-4.3-sysmacros.patch
meta/recipes-devtools/squashfs-tools/squashfs-tools/squashfs-tools-4.3-sysmacros.patch new file +32 -0
@@ -0,0 +1,32 @@ +From https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-fs/squashfs-tools/files/squashfs-tools-4.3-sysmacros.patch + +Signed-off-by: Martin Jansa <[email protected]> + +Upstream-Status: Pending + + +sys/types.h might not always include sys/sysmacros.h for major/minor/makedev + +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -59,6 +59,7 @@ + #else + #include <endian.h> + #include <sys/sysinfo.h> ++#include <sys/sysmacros.h> + #endif + + #include "squashfs_fs.h" +--- a/squashfs-tools/unsquashfs.c ++++ b/squashfs-tools/unsquashfs.c +@@ -38,6 +38,10 @@ + #include <limits.h> + #include <ctype.h> + ++#ifdef linux ++#include <sys/sysmacros.h> ++#endif ++ + struct cache *fragment_cache, *data_cache; + struct queue *to_reader, *to_inflate, *to_writer, *from_writer; + pthread_t *thread, *inflator_thread;
meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb +1 -0
@@ -13,6 +13,7 @@ SRCREV = "9c1db6d13a51a2e009f0027ef336ce03624eac0d" SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https \ http://downloads.sourceforge.net/sevenzip/lzma465.tar.bz2;name=lzma \ file://0001-mksquashfs.c-get-inline-functions-work-with-C99.patch;striplevel=2 \ + file://squashfs-tools-4.3-sysmacros.patch;striplevel=2 \ file://fix-compat.patch \ " UPSTREAM_VERSION_UNKNOWN = "1"
Signature · 1 line
2.14.1
PATCH 2/2 grub2: fix build with gcc-7
* 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
--- meta/recipes-bsp/grub/grub-efi_2.02.bb | 6 ++++++ 1 file changed, 6 insertions(+)
meta/recipes-bsp/grub/grub-efi_2.02.bb +6 -0
@@ -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" + do_install_class-native() { install -d ${D}${bindir} install -m 755 grub-mkimage ${D}${bindir}
Signature · 1 line
2.14.1
Re: [PATCH 2/2] grub2: fix build with gcc-7
Quoted 4 lines · Martin Jansa
* 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 \ |
^~~~~~~~~~~~~~~
Quoted 14 lines
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 <[email protected]>--- meta/recipes-bsp/grub/grub-efi_2.02.bb | 6 ++++++ 1 file changed, 6 insertions(+)meta/recipes-bsp/grub/grub-efi_2.02.bb +0
-0
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no" · line 44
Quoted 9 lines
meta/recipes-bsp/grub/grub-efi_2.02.bb +6
-0@@ -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.
Quoted 11 lines
meta/recipes-bsp/grub/grub-efi_2.02.bb +0
-1do_install_class-native() { install -d ${D}${bindir} install -m 755 grub-mkimage ${D}${bindir} --2.14.1
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [PATCH 2/2] grub2: fix build with gcc-7
Nothing special on my build host, just gcc 7.1 from gentoo. But the option was introduced probably only in gcc-7, on 5.4.0 used in Ubuntu 16.04 it's also missing:
OE qemux86@ ~/oe/world/shr-core $ gcc --help=warnings | grep expansion-to-defined
OE qemux86@ ~/oe/world/shr-core $ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
OE @ ~ $ gcc --help=warnings | grep expansion-to-defined
-Wexpansion-to-defined Warn if "defined" is used outside #if.
OE @ ~ $ gcc --version
gcc (Gentoo 7.1.0-r1 p1.1) 7.1.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
OE @ ~/build/oe-core/tmp-glibc/work/i586-oe-linux/grub-efi/2.02-r0 $ recipe-sysroot-native/usr/bin/i586-oe-linux/i586-oe-linux-gcc --help=warnings | grep expansion-to-defined
-Wexpansion-to-defined Warn if "defined" is used outside #if.
OE @ ~/build/oe-core/tmp-glibc/work/i586-oe-linux/grub-efi/2.02-r0 $ recipe-sysroot-native/usr/bin/i586-oe-linux/i586-oe-linux-gcc --version i586-oe-linux-gcc (GCC) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Applying the flags based on gcc --version output also doesn't seem good way forward and we don't have gcc-native recipes.
We can probably use gcc pragma to disable this warning (which IIRC doesn't test if the disabled warning is supported or not), but that might be a bit complicated as this file is generated in configure. I'll check it.
The target grub-efi build doesn't fail probably because target gcc doesn't define _FORTIFY_SOURCE
I've tried to compare native and target build and it's reproducible e.g. with this command:
gcc -DHAVE_CONFIG_H -I. -I../grub-2.02 -Wall -W -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub-core/lib/crypto.c\" -I. -I../grub-2.02 -I. -I../grub-2.02 -I../grub-2.02/include -I./include -I../grub-2.02/grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib -I../grub-2.02/grub-core/gnulib -D_FILE_OFFSET_BITS=64 -fno-builtin-gettext -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-error=trampolines -c -o grub-core/lib/libgrubkern_a-crypto.o test -f 'grub-core/lib/crypto.c' || echo '../grub-2.02/'grub-core/lib/crypto.c
After adding -dM -E and comparing the output between target and native I can see that my native gcc defines _FORTIFY_SOURCE as:
#define _FORTIFY_SOURCE ((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)
while target build doesn't.
Just to confirm it's caused by this I've added the same line:
#define _FORTIFY_SOURCE ((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0) at the top of grub-2.02/grub-core/lib/crypto.c and the target build fails the same.
And the _FORTIFY_SOURCE in native gcc comes from gentoo gcc patches, this one:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/7.1.0/gentoo/10_all_default-fortify-source.patch?view=markup
PATCHv2 with #pragma coming soon.
Quoted 59 lines · Khem Raj
Quoted 2 lines · Martin Jansa
* build with gcc-7 fails with:
| ./config-util.h:1504:48: error: this use of "defined" may not beportable [-Werror=expansion-to-defined]
Quoted 2 lines
| || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ |^~~~~~~~~~~~~~~Review
Quoted 10 lines
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 <[email protected]>--- meta/recipes-bsp/grub/grub-efi_2.02.bb | 6 ++++++ 1 file changed, 6 insertions(+)(quoted diff) +0
-0b/meta/recipes-bsp/grub/grub-efi_2.02.bb
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no" · line 36
Quoted 5 lines
index
b949bebced..45f4c1ed34100644meta/recipes-bsp/grub/grub-efi_2.02.bb +0
-0@@ -36,6 +36,12 @@ EXTRA_OECONF += "--enable-efiemu=no" # and many other places in the grub code when compiled with some nativegcc compilers (specifically, gentoo)
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no"
Quoted 3 lines
meta/recipes-bsp/grub/grub-efi_2.02.bb +1
-0CFLAGS_append_class-native = " -Wno-error=trampolines" +# this comes from gnulib and it's used only for Apple and BSD, so wecan ignore it
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no" · line 40
Quoted 1 line
meta/recipes-bsp/grub/grub-efi_2.02.bb +1
-0+# ./config-util.h:1504:48: error: this use of "defined" may not beportable [-Werror=expansion-to-defined]
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no" · line 44
Quoted 4 lines
meta/recipes-bsp/grub/grub-efi_2.02.bb +4
-0+# || (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.Quoted 11 lines
meta/recipes-bsp/grub/grub-efi_2.02.bb +0
-1do_install_class-native() { install -d ${D}${bindir} install -m 755 grub-mkimage ${D}${bindir} --2.14.1
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [PATCH 2/2] grub2: fix build with gcc-7
I have sent few patches to meta oe to fix similar issues earlier found with clang I think changes to code to define the macros in compliant way are better and upstreamable
Quoted 153 lines · Martin Jansa
Nothing special on my build host, just gcc 7.1 from gentoo. But the option was introduced probably only in gcc-7, on 5.4.0 used in Ubuntu 16.04 it's also missing:
OE qemux86@ ~/oe/world/shr-core $ gcc --help=warnings | grep expansion-to-defined
OE qemux86@ ~/oe/world/shr-core $ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.OE @ ~ $ gcc --help=warnings | grep expansion-to-defined
-Wexpansion-to-defined Warn if "defined" is used outside #if.
OE @ ~ $ gcc --version
gcc (Gentoo 7.1.0-r1 p1.1) 7.1.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.OE @ ~/build/oe-core/tmp-glibc/work/i586-oe-linux/grub-efi/2.02-r0 $ recipe-sysroot-native/usr/bin/i586-oe-linux/i586-oe-linux-gcc --help=warnings | grep expansion-to-defined
-Wexpansion-to-defined Warn if "defined" is used outside #if.
OE @ ~/build/oe-core/tmp-glibc/work/i586-oe-linux/grub-efi/2.02-r0 $ recipe-sysroot-native/usr/bin/i586-oe-linux/i586-oe-linux-gcc --version i586-oe-linux-gcc (GCC) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Applying the flags based on
gcc --versionoutput also doesn't seem good way forward and we don't have gcc-native recipes.We can probably use gcc pragma to disable this warning (which IIRC doesn't test if the disabled warning is supported or not), but that might be a bit complicated as this file is generated in configure. I'll check it.
The target grub-efi build doesn't fail probably because target gcc doesn't define
_FORTIFY_SOURCEI've tried to compare native and target build and it's reproducible e.g. with this command:
gcc -DHAVE_CONFIG_H -I. -I../grub-2.02 -Wall -W -DGRUB_UTIL=1
(quoted diff) +0
-20-D_FILE_OFFSET_BITS=64 -I./include -DGRUB_FILE=\"grub-core/lib/crypto.c\" -I. -I../grub-2.02 -I. -I../grub-2.02 -I../grub-2.02/include -I./include -I../grub-2.02/grub-core/lib/libgcrypt-grub/src/ -I./grub-core/gnulib -I../grub-2.02/grub-core/gnulib -D_FILE_OFFSET_BITS=64 -fno-builtin-gettext -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-error=trampolines -c -o
grub-core/lib/libgrubkern_a-crypto.otest -f 'grub-core/lib/crypto.c' || echo '../grub-2.02/'grub-core/lib/crypto.cAfter adding -dM -E and comparing the output between target and native I can see that my native gcc defines
_FORTIFY_SOURCEas:
#define_FORTIFY_SOURCE((defined__OPTIMIZE__&&__OPTIMIZE__> 0) ? 2 :
0)while target build doesn't.
Just to confirm it's caused by this I've added the same line:
#define_FORTIFY_SOURCE((defined__OPTIMIZE__&&__OPTIMIZE__> 0) ? 2 :
0)
at the top ofgrub-2.02/grub-core/lib/crypto.cand the target build fails the same.And the
_FORTIFY_SOURCEin native gcc comes from gentoo gcc patches, this one:PATCHv2 with #pragma coming soon.
Quoted 59 lines · Khem Raj
Quoted 2 lines · Martin Jansa
* build with gcc-7 fails with:
| ./config-util.h:1504:48: error: this use of "defined" may not beportable [-Werror=expansion-to-defined]
Quoted 2 lines
| || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ |^~~~~~~~~~~~~~~Review
Quoted 10 lines
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 <[email protected]>--- meta/recipes-bsp/grub/grub-efi_2.02.bb | 6 ++++++ 1 file changed, 6 insertions(+)(quoted diff) +0
-0b/meta/recipes-bsp/grub/grub-efi_2.02.bb
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no" · line 36
Quoted 5 lines
index
b949bebced..45f4c1ed34100644meta/recipes-bsp/grub/grub-efi_2.02.bb +0
-0@@ -36,6 +36,12 @@ EXTRA_OECONF += "--enable-efiemu=no" # and many other places in the grub code when compiled with somenative gcc compilers (specifically, gentoo)
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no"
Quoted 3 lines
meta/recipes-bsp/grub/grub-efi_2.02.bb +1
-0CFLAGS_append_class-native = " -Wno-error=trampolines" +# this comes from gnulib and it's used only for Apple and BSD, so wecan ignore it
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no" · line 40
Quoted 1 line
meta/recipes-bsp/grub/grub-efi_2.02.bb +1
-0+# ./config-util.h:1504:48: error: this use of "defined" may not beportable [-Werror=expansion-to-defined]
meta/recipes-bsp/grub/grub-efi_2.02.bb EXTRA_OECONF += "--enable-efiemu=no" · line 44
Quoted 4 lines
meta/recipes-bsp/grub/grub-efi_2.02.bb +4
-0+# || (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.Quoted 11 lines
meta/recipes-bsp/grub/grub-efi_2.02.bb +0
-1do_install_class-native() { install -d ${D}${bindir} install -m 755 grub-mkimage ${D}${bindir} --2.14.1
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
PATCH v2 1/1 grub2: fix build on gcc where _FORTIFY_SOURCE is defined
In reply to Martin Jansa* e.g. with gentoo gcc-7.1 they define _FORTIFY_SOURCE by default with:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/7.1.0/gentoo/10_all_default-fortify-source.patch?view=markup
which results in following error while building grub-efi-native:
./config-util.h:1504:48: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
|| (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
^~~~~~~~~~~~~~~ this part comes from gnulib and it's used only for Apple and BSD, so we can ignore it, but we cannot add -Wno-error=expansion-to-defined because this warning was introduced only in gcc-7 and older gcc will fail with:
cc1: error: -Werror=expansion-to-defined: no option -Wexpansion-to-defined use #pragma to work around this
---
v2: this version works on hosts with older gcc, tested on Ubuntu-16.04
with gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
.../grub/files/fix.build.with.gcc-7.patch | 39 ++++++++++++++++++++++ meta/recipes-bsp/grub/grub2.inc | 1 + 2 files changed, 40 insertions(+) create mode 100644 meta/recipes-bsp/grub/files/fix.build.with.gcc-7.patch
meta/recipes-bsp/grub/files/fix.build.with.gcc-7.patch new file +39 -0
@@ -0,0 +1,39 @@ +* e.g. with gentoo gcc-7.1 they define _FORTIFY_SOURCE by default with: + https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/7.1.0/gentoo/10_all_default-fortify-source.patch?view=markup + which results in following error while building grub-efi-native: + ./config-util.h:1504:48: error: this use of "defined" may not be portable [-Werror=expansion-to-defined] + || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ + ^~~~~~~~~~~~~~~ + this part comes from gnulib and it's used only for Apple and BSD, + so we can ignore it, but we cannot add -Wno-error=expansion-to-defined + because this warning was introduced only in gcc-7 and older gcc + will fail with: + cc1: error: -Werror=expansion-to-defined: no option -Wexpansion-to-defined + use #pragma to work around this + +Upstream-Status: Pending (should be fixed in gnulib which is then rarely updated in grub) + +Signed-off-by: Martin Jansa <[email protected]> + +diff -uNr grub-2.02.old/m4/extern-inline.m4 grub-2.02/m4/extern-inline.m4 +--- grub-2.02.old/m4/extern-inline.m4 2016-02-28 15:22:21.000000000 +0100 ++++ grub-2.02/m4/extern-inline.m4 2017-08-22 19:26:45.213637276 +0200 +@@ -39,6 +39,10 @@ + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and + for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. + Assume DragonFly and FreeBSD will be similar. */ ++#pragma GCC diagnostic push ++#if __GNUC__ >= 7 ++#pragma GCC diagnostic ignored "-Wexpansion-to-defined" ++#endif + #if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ + && (defined __header_inline \ +@@ -50,6 +52,7 @@ + && defined __GNUC__ && ! defined __cplusplus)))) + # define _GL_EXTERN_INLINE_STDHEADER_BUG + #endif ++#pragma GCC diagnostic pop + #if ((__GNUC__ \ + ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + : (199901L <= __STDC_VERSION__ \
meta/recipes-bsp/grub/grub2.inc +1 -0
@@ -17,6 +17,7 @@ SRC_URI = "https://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \ file://autogen.sh-exclude-pc.patch \ file://grub-module-explicitly-keeps-symbole-.module_license.patch \ file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \ + file://fix.build.with.gcc-7.patch \ " SRC_URI[md5sum] = "1116d1f60c840e6dbd67abbc99acb45d" SRC_URI[sha256sum] = "660ee136fbcee08858516ed4de2ad87068bfe1b6b8b37896ce3529ff054a726d"
Signature · 1 line
2.14.1
Re: [PATCH 2/2] grub2: fix build with gcc-7
In reply to Martin JansaQuoted 5 lines · Martin Jansa
* 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 \ | ^~~~~~~~~~~~~~~
Quoted 8 lines
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 <[email protected]>---
meta/recipes-bsp/grub/grub-efi_2.02.bb | 6 ++++++1 file changed, 6 insertions(+)
Sadly this appears to break grub-efi everywhere on the autobuilder, e.g.:
https://autobuilder.yocto.io/builders/nightly-no-x11/builds/428/steps/BuildImages/logs/stdio
I took a risk and tried to get this into M3 buts its not paid off and we'll need another rebuild :(.
Cheers,
Richard
Re: [PATCH 2/2] grub2: fix build with gcc-7
I'm sorry for the issues caused by this, can you share config.log from that build? Maybe the native compiler on that build host doesn't support this option?
Quoted 30 lines · Richard Purdie
Quoted 5 lines · Martin Jansa
* 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 \ | ^~~~~~~~~~~~~~~Quoted 8 lines
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 <[email protected]>--- meta/recipes-bsp/grub/grub-efi_2.02.bb | 6 ++++++ 1 file changed, 6 insertions(+)Sadly this appears to break grub-efi everywhere on the autobuilder, e.g.:
https://autobuilder.yocto.io/builders/nightly-no-x11/
builds/428/steps/BuildImages/logs/stdioI took a risk and tried to get this into M3 buts its not paid off and we'll need another rebuild :(.
Cheers,
Richard
Re: [PATCH 2/2] grub2: fix build with gcc-7
Quoted 3 lines · Martin Jansa
I'm sorry for the issues caused by this, can you share config.log from that build? Maybe the native compiler on that build host doesn't support this option?
The one I linked to was a debian9 system, config.log says:
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:5052: $? = 1
configure:5072: checking whether the C compiler works
configure:5094: gcc -Wno-error=trampolines -Wno-error=expansion-to-defined conftest.c >&5
cc1: error: -Werror=expansion-to-defined: no option -Wexpansion-to-defined configure:5098: $? = 1
configure:5136: result: no
configure: failed program was:
| /* confdefs.h */ | #define PACKAGE_NAME "GRUB" | #define PACKAGE_TARNAME "grub" | #define PACKAGE_VERSION "2.02" | #define PACKAGE_STRING "GRUB 2.02" | #define PACKAGE_BUGREPORT "[email protected]" | #define PACKAGE_URL "" | #define PACKAGE "grub" | #define VERSION "2.02" | #define GRUB_BOOT_DIR_NAME "boot" | #define GRUB_DIR_NAME "grub" | /* end confdefs.h. */ | | int | main (void) | { | | ; | return 0; | }
configure:5141: error: in `/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-no-x11/build/build/tmp/work/x86_64-linux/grub-efi-native/2.02-r0/build':
configure:5143: error: C compiler cannot create executables
See `config.log' for more details
So yes, it doesn't understand the option.
Cheers,
Richard
Re: [PATCH 2/2] grub2: fix build with gcc-7
In reply to Richard PurdieQuoted 15 lines · Richard Purdie
Quoted 5 lines · Martin Jansa
* 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 \ | ^~~~~~~~~~~~~~~Quoted 8 lines
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 <[email protected]>--- meta/recipes-bsp/grub/grub-efi_2.02.bb | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 8 lines
Sadly this appears to break grub-efi everywhere on the autobuilder, e.g.:
https://autobuilder.yocto.io/builders/nightly-no-x11/builds/428/steps/BuildImages/logs/stdio
I took a risk and tried to get this into M3 buts its not paid off and we'll need another rebuild :(.
It did not occur to me that this option is introduced in gcc7+ which means it will not work on hosts using old gcc versions. Sorry
Quoted 10 lines
Cheers,
Richard
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core