Skip to contentSkip to conversation

grub 1.99: fix build for gcc 4.7

PATCH In review Robert Yang 3 participants 8 messages Apr 13, 2012 – Apr 14, 2012

lore
Share & tools
lore
#0 lore raw

cover grub 1.99: fix build for gcc 4.7

I've done a "bitbake world" on Fedora 17 64bit (MACHINE = qemux86-64), the failed pkgs are mklibs-native (have sent patch) and grub as far as I know.

Will try "bitbake core-image-sato" with MACHINE = qemuarm/qemuppc/qemux86 and "bitbake world" with MACHINE = qemux86 on Fedora 17 64bit this night.

Test info:
Have tested on:
Ubuntu 10.10
Fedora 13/16/17 x86_64

// Robert

The following changes since commit 71e95c744eaa4dda1b3237db2e13f666f121c92b:

package_rpm.bbclass: Set tmppath for rpm to somewhere which won't conflict with the rootfs (2012-04-12 21:24:55 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/grub
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/grub

Robert Yang (1):
grub 1.99: fix build for gcc 4.7

 meta/recipes-bsp/grub/grub_1.99.bb |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/1 grub 1.99: fix build for gcc 4.7

There was an error when build with gcc 4.7 (FC 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.

[YOCTO #2291]

---
 meta/recipes-bsp/grub/grub_1.99.bb |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
meta/recipes-bsp/grub/grub_1.99.bb +6 -1
index ac66e83..f45b634 100644
@@ -12,7 +12,7 @@ LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 RDEPENDS_${PN} = "diffutils freetype"
-PR = "r3"
+PR = "r4"
 
 SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
           file://grub-install.in.patch \
@@ -29,6 +29,11 @@ inherit gettext
 EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont --target=${TARGET_ARCH} --program-prefix="""
 
 do_configure() {
+    # Fix build error for gcc 4.7
+    echo "CPPFLAGS_DEFAULT += -fno-strict-aliasing" >> conf/Makefile.common
+    # Also modify Makefile.in, we can remove this when we can run autoreconf
+    sed -i 's/^CPPFLAGS_DEFAULT = \(.*\)/CPPFLAGS_DEFAULT = -fno-strict-aliasing \1/' \
+	Makefile.in grub-core/Makefile.in
     oe_runconf
 }
 
Signature · 1 line
1.7.1
#2 lore raw
Quoted 6 lines · Robert Yang

There was an error when build with gcc 4.7 (FC 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

Quoted 7 lines

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.

This seems a bit more than whats needed. You could try adding -Wno-error=strict-aliasing to CFLAGS

on another note. I do not see this failing with gcc-4.7(target compiler) here when I build grub for qemux86 so I am a bit puzzled

Quoted 41 lines

[YOCTO #2291]

---
 meta/recipes-bsp/grub/grub_1.99.bb |    7 ++++++-

 1 files changed, 6 insertions(+), 1 deletions(-)
meta/recipes-bsp/grub/grub_1.99.bb +0 -0
index ac66e83..f45b634 100644
@@ -12,7 +12,7 @@ LICENSE = "GPLv3"

 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"

 RDEPENDS_${PN} = "diffutils freetype"

meta/recipes-bsp/grub/grub_1.99.bb +1 -1
-PR = "r3"
+PR = "r4"

 SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
          file://grub-install.in.patch \

meta/recipes-bsp/grub/grub_1.99.bb +0 -0
@@ -29,6 +29,11 @@ inherit gettext

 EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont --target=${TARGET_ARCH} --program-prefix="""

 do_configure() {
+    # Fix build error for gcc 4.7
+    echo "CPPFLAGS_DEFAULT += -fno-strict-aliasing" >> conf/Makefile.common
+    # Also modify Makefile.in, we can remove this when we can run autoreconf
+    sed -i 's/^CPPFLAGS_DEFAULT = \(.*\)/CPPFLAGS_DEFAULT = -fno-strict-aliasing \1/' \
+       Makefile.in grub-core/Makefile.in
    oe_runconf
 }

--
1.7.1

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 27 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Khem Raj
Sent: Friday, April 13, 2012 1:21 PM
To: Patches and discussions about the oe-core layer
Subject: Re: [OE-core] [PATCH 1/1] grub 1.99: fix build for gcc 4.7

Quoted 9 lines · Robert Yang

There was an error when build with gcc 4.7 (FC 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

Quoted 5 lines

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,

Quoted 9 lines

this

Quoted 1 line

would disable the optimization for strict-aliasing.

This seems a bit more than whats needed. You could try adding -Wno- error=strict-aliasing to CFLAGS

on another note. I do not see this failing with gcc-4.7(target compiler) here when I build grub for qemux86 so I am a bit puzzled

Khem,
There is another grub recipe issue, it is building target binaries with distro compiler. Probably because of that you did not see issue with 4.7 cross compiler. We have fix for that issue now.

Nitin

Quoted 52 lines
Quoted 14 lines

[YOCTO #2291]

---
 meta/recipes-bsp/grub/grub_1.99.bb |    7 ++++++-

 1 files changed, 6 insertions(+), 1 deletions(-)
meta/recipes-bsp/grub/grub_1.99.bb +0 -0
index ac66e83..f45b634 100644
@@ -12,7 +12,7 @@ LICENSE = "GPLv3"
Quoted 1 line

 LIC_FILES_CHKSUM =

"file://COPYING;md5=d32239bcb673463ab874e80d47fae504"

Quoted 9 lines

 RDEPENDS_${PN} = "diffutils freetype"

meta/recipes-bsp/grub/grub_1.99.bb +1 -1
-PR = "r3"
+PR = "r4"

 SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
          file://grub-install.in.patch \ @@ -29,6 +29,11 @@ inherit gettext
 EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont --

target=${TARGET_ARCH} --program-prefix="""

Quoted 13 lines

 do_configure() {
+    # Fix build error for gcc 4.7
+    echo "CPPFLAGS_DEFAULT += -fno-strict-aliasing" >>
+ conf/Makefile.common
+    # Also modify Makefile.in, we can remove this when we can run
+ autoreconf
+    sed -i 's/^CPPFLAGS_DEFAULT = \(.*\)/CPPFLAGS_DEFAULT =
+ -fno-strict-aliasing \1/' \
+       Makefile.in grub-core/Makefile.in
    oe_runconf
 }

Quoted 8 lines

--
1.7.1

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#4 lore raw
Quoted 51 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Kamble, Nitin A
Sent: Friday, April 13, 2012 4:43 PM
To: Patches and discussions about the oe-core layer
Subject: Re: [OE-core] [PATCH 1/1] grub 1.99: fix build for gcc 4.7

Quoted 3 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf

Of

Quoted 10 lines

Khem Raj
Sent: Friday, April 13, 2012 1:21 PM
To: Patches and discussions about the oe-core layer
Subject: Re: [OE-core] [PATCH 1/1] grub 1.99: fix build for gcc 4.7

Quoted 3 lines · Robert Yang

There was an error when build with gcc 4.7 (FC 17 64bit):
| fs/zfs/zfs.c: In function 'get_filesystem_dnode':
| fs/zfs/zfs.c:1449:7: error: dereferencing type-punned pointer

will

Quoted 9 lines
Quoted 6 lines

| 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

Quoted 2 lines

gcc
4.7.0 has changed its algorithm for the strict aliasing check, but

I

Quoted 12 lines
Quoted 3 lines

didn't find the related information from its release note.

Add "-fno-strict-aliasing" to gcc's option would fix the problem,

this

Quoted 1 line

would disable the optimization for strict-aliasing.

This seems a bit more than whats needed. You could try adding -Wno- error=strict-aliasing to CFLAGS

on another note. I do not see this failing with gcc-4.7(target compiler) here when I build grub for qemux86 so I am a bit puzzled

Quoted 7 lines

Khem,
There is another grub recipe issue, it is building target binaries
with distro compiler. Probably because of that you did not see issue with 4.7 cross compiler. We have fix for that issue now.

Nitin

Khem, Look at these:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=2291
https://bugzilla.yoctoproject.org/show_bug.cgi?id=2293

And both have been fixed.

Nitin

Quoted 60 lines
Quoted 23 lines
Quoted 16 lines

[YOCTO #2291]

---
 meta/recipes-bsp/grub/grub_1.99.bb |    7 ++++++-

 1 files changed, 6 insertions(+), 1 deletions(-)
meta/recipes-bsp/grub/grub_1.99.bb +0 -0
index ac66e83..f45b634 100644
@@ -12,7 +12,7 @@ LICENSE = "GPLv3"
Quoted 1 line

 LIC_FILES_CHKSUM =

"file://COPYING;md5=d32239bcb673463ab874e80d47fae504"

Quoted 5 lines

 RDEPENDS_${PN} = "diffutils freetype"

meta/recipes-bsp/grub/grub_1.99.bb +1 -1
-PR = "r3"
+PR = "r4"
Quoted 26 lines
Quoted 4 lines

 SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
          file://grub-install.in.patch \ @@ -29,6 +29,11 @@ inherit gettext
 EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont --

target=${TARGET_ARCH} --program-prefix="""

Quoted 21 lines

 do_configure() {
+    # Fix build error for gcc 4.7
+    echo "CPPFLAGS_DEFAULT += -fno-strict-aliasing" >>
+ conf/Makefile.common
+    # Also modify Makefile.in, we can remove this when we can run
+ autoreconf
+    sed -i 's/^CPPFLAGS_DEFAULT = \(.*\)/CPPFLAGS_DEFAULT =
+ -fno-strict-aliasing \1/' \
+       Makefile.in grub-core/Makefile.in
    oe_runconf
 }

--
1.7.1

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-

cor

Quoted 6 lines
Quoted 1 line

e

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#5 lore raw
In reply to Kamble, Nitin A
Quoted 33 lines · Nitin A
Quoted 33 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Khem Raj
Sent: Friday, April 13, 2012 1:21 PM
To: Patches and discussions about the oe-core layer
Subject: Re: [OE-core] [PATCH 1/1] grub 1.99: fix build for gcc 4.7

Quoted 9 lines · Robert Yang

There was an error when build with gcc 4.7 (FC 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

Quoted 5 lines

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

Quoted 1 line

would disable the optimization for strict-aliasing.

This seems a bit more than whats needed. You could try adding -Wno- error=strict-aliasing to CFLAGS

Quoted 7 lines
Quoted 3 lines

on another note. I do not see this failing with gcc-4.7(target compiler) here when I build grub for qemux86 so I am a bit puzzled

Khem,
 There is another grub recipe issue, it is building target binaries with distro compiler. Probably because of that you did not see issue with 4.7 cross compiler. We have fix for that issue now.

hmmm interesting that clarifies. So I guess once you fix it to do _proper_ cross compile build then I guess the problem gets fixed when we use gcc 4.6 but as soon as we move to gcc-4.7 this will reappear so in any case this issue needs to fixed in a good manner I think in anycase.

#6 lore raw
Quoted 52 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Khem Raj
Sent: Friday, April 13, 2012 8:20 PM
To: Patches and discussions about the oe-core layer
Subject: Re: [OE-core] [PATCH 1/1] grub 1.99: fix build for gcc 4.7

Quoted 33 lines · Nitin A
Quoted 33 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Khem Raj
Sent: Friday, April 13, 2012 1:21 PM
To: Patches and discussions about the oe-core layer
Subject: Re: [OE-core] [PATCH 1/1] grub 1.99: fix build for gcc 4.7

Quoted 9 lines · Robert Yang

There was an error when build with gcc 4.7 (FC 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

Quoted 5 lines

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

Quoted 1 line

would disable the optimization for strict-aliasing.

This seems a bit more than whats needed. You could try adding -Wno- error=strict-aliasing to CFLAGS

Quoted 7 lines
Quoted 3 lines

on another note. I do not see this failing with gcc-4.7(target compiler) here when I build grub for qemux86 so I am a bit puzzled

Khem,
 There is another grub recipe issue, it is building target binaries

Quoted 9 lines

with distro compiler. Probably because of that you did not see issue with 4.7 cross compiler. We have fix for that issue now.

hmmm interesting that clarifies. So I guess once you fix it to do _proper_ cross compile build then I guess the problem gets fixed when we use gcc 4.6 but as soon as we move to gcc-4.7 this will reappear so in any case this issue needs to fixed in a good manner I think in anycase.

The 2293 bug is about grub-efi-native which correctly uses the distro compiler. And it hits gcc 4.7 issue on fedora 17 alpha, and that is also fixed. I will send out commits in few mins.

Nitin

Quoted 4 lines

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#7 lore raw
In reply to Robert Yang
Quoted 1 line · Robert Yang

I've done a "bitbake world" on Fedora 17 64bit (MACHINE = qemux86-64),

The MACHINE is qemux86 (not qemux86-64), sorry for the mistake.

Quoted 5 lines

the failed pkgs are mklibs-native (have sent patch) and grub as far as I know.

Will try "bitbake core-image-sato" with MACHINE = qemuarm/qemuppc/qemux86 and "bitbake world" with MACHINE = qemux86 on Fedora 17 64bit this

Here should be: MACHINE = qemux86-64

// Robert

Quoted 29 lines

night.

Test info:
Have tested on:
Ubuntu 10.10
Fedora 13/16/17 x86_64

// Robert

The following changes since commit 71e95c744eaa4dda1b3237db2e13f666f121c92b:

package_rpm.bbclass: Set tmppath for rpm to somewhere which won't conflict with the rootfs (2012-04-12 21:24:55 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/grub
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/grub

Robert Yang (1):
grub 1.99: fix build for gcc 4.7

  meta/recipes-bsp/grub/grub_1.99.bb |    7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core