On Fedora FC17 x86_64: bitbake grub, there was an error when build with gcc 4.7 (On Fedora 17 64bit): | fs/zfs/zfs.c: In function 'get_filesystem_dnode': | fs/zfs/zfs.c:1449:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] ...... cc1: all warnings being treated as errors While compare the compile command between gcc 4.4.4 and gcc 4.7.0, they are the same (both of them have -Wall and -Werror), it seems that gcc 4.7.0 has changed its algorithm for the strict aliasing check, but I didn't find the related information from its release note. Add "-fno-strict-aliasing" to gcc's option would fix the problem, this would disable the optimization for strict-aliasing.
I notice there are more errors for grub build on fedora 17 alpha And Richard suggested to try fixing code instead of fixing the compilation options, and I am looking into it now. | gcc -DHAVE_CONFIG_H -I. -I.. -Wall -W -I../include -I../include -DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC - nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include -DGRUB_FILE=\"gfxmenu/icon_manager.c\" -I. -I. -I.. -I.. -I../include -I../include -O2 -pipe -g -feliminate-unused-debug-types -Wall -W -Wshadow -Wpointer-arith -W missing-prototypes -Wundef -Wstrict-prototypes -g -falign-jumps=1 -falign-loops=1 -falign-functions=1 -mno-mmx -mno- sse -mno-sse2 -mno-3dnow -fno-dwarf2-cfi-asm -m32 -fno-stack-protector -mno-stack-arg-probe -Werror -Wno-trampolines -mrtd -mregparm=3 -ffreestanding -O2 -pipe -g -feliminate-unused-debug-types -c -o gfxmenu/gfxmenu_module- icon_manager.o `test -f 'gfxmenu/icon_manager.c' || echo './'`gfxmenu/icon_manager.c | fs/zfs/zfs.c: In function 'get_filesystem_dnode': | fs/zfs/zfs.c:1449:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-ali asing] | fs/zfs/zfs.c:1449:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-ali asing] | fs/zfs/zfs.c: In function 'make_mdn': | fs/zfs/zfs.c:1478:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-ali asing] | fs/zfs/zfs.c: In function 'dnode_get_fullpath': | fs/zfs/zfs.c:1554:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:1554:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:1571:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:1571:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c: In function 'grub_zfs_open': | fs/zfs/zfs.c:2234:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2234:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c: In function 'fill_fs_info': | fs/zfs/zfs.c:2362:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2362:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2395:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2395:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c: In function 'iterate_zap': | fs/zfs/zfs.c:2420:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2420:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c: In function 'grub_zfs_dir': | fs/zfs/zfs.c:2483:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2483:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2484:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2484:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2502:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | fs/zfs/zfs.c:2502:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] | cc1: all warnings being treated as errors | make[3]: *** [fs/zfs/zfs_module-zfs.o] Error 1 | make[3]: *** Waiting for unfinished jobs.... | fs/btrfs.c: In function 'grub_btrfs_read_logical': | fs/btrfs.c:791:5: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized] | fs/btrfs.c:592:18: note: 'err' was declared here | cc1: all warnings being treated as errors | make[3]: *** [fs/btrfs_module-btrfs.o] Error 1 | make[3]: Leaving directory `/home/nitin/builds/build0/tmp/work/i586-poky-ERROR: Function failed: do_compile (see /home/nitin/builds/build0/tmp/work/i586-poky-linux/grub-1.99-r3/temp/log.do_compile.2260 for further information) | linux/grub-1.99-r3/grub-1.99/grub-core' | make[2]: *** [all] Error 2 | make[2]: Leaving directory `/home/nitin/builds/build0/tmp/work/i586-poky-linux/grub-1.99-r3/grub-1.99/grub-core' | make[1]: *** [all-recursive] Error 1 | make[1]: Leaving directory `/home/nitin/builds/build0/tmp/work/i586-poky-linux/grub-1.99-r3/grub-1.99' | make: *** [all] Error 2 | ERROR: oe_runmake failed NOTE: package grub-1.99-r3: task do_compile: Failed ERROR: Task 7 (/home/nitin/prj/poky.git/meta/recipes-bsp/grub/grub_1.99.bb, do_compile) failed with exit code '1'
Also noticed that target grub is built with distro gcc rather than target gcc. Hence this issue is present on fedora 17.
By using the gcc-cross rather than distro gcc, the problem gets fixed. I will post the commit to mailing list soon.
Now I am trying with this commit to fix the issue: but it is giving me these autoconf errors now. | acinclude.m4:363: grub_CHECK_STACK_ARG_PROBE is expanded from... | configure.ac:532: the top level | conf/Makefile.common:43: subst $(srcdir: non-POSIX variable name | conf/Makefile.common:43: (probably a GNU make extension) | grub-core/Makefile.am:5: `conf/Makefile.common' included from here | conf/Makefile.common:150: `pkglibdir' is not a legitimate directory for `SCRIPTS' | grub-core/Makefile.am:5: `conf/Makefile.common' included from here | conf/Makefile.common:140: `pkglibdir' is not a legitimate directory for `DATA' | grub-core/Makefile.am:5: `conf/Makefile.common' included from here | conf/Makefile.common:43: subst $(srcdir: non-POSIX variable name | conf/Makefile.common:43: (probably a GNU make extension) | Makefile.am:6: `conf/Makefile.common' included from here | conf/Makefile.extra-dist:29: shell find $(top_srcdir: non-POSIX variable name | conf/Makefile.extra-dist:29: (probably a GNU make extension) | Makefile.am:7: `conf/Makefile.extra-dist' included from here | conf/Makefile.extra-dist:30: shell find $(top_srcdir: non-POSIX variable name | conf/Makefile.extra-dist:30: (probably a GNU make extension) | Makefile.am:7: `conf/Makefile.extra-dist' included from here | conf/Makefile.extra-dist:31: shell find $(top_srcdir: non-POSIX variable name | conf/Makefile.extra-dist:31: (probably a GNU make extension) | Makefile.am:7: `conf/Makefile.extra-dist' included from here | conf/Makefile.extra-dist:32: shell find $(top_srcdir: non-POSIX variable name | conf/Makefile.extra-dist:32: (probably a GNU make extension) | Makefile.am:7: `conf/Makefile.extra-dist' included from here | conf/Makefile.common:150: `pkglibdir' is not a legitimate directory for `SCRIPTS' | Makefile.am:6: `conf/Makefile.common' included from here | conf/Makefile.common:140: `pkglibdir' is not a legitimate directory for `DATA' | Makefile.am:6: `conf/Makefile.common' included from here
Merged in master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=53d629496f344d07e7ab261d789918cd80308b45