Patchwork [1/1] glib-2.0-native:add option march to BUILD_CFLAGS

login
register
mail settings
Submitter Hongxu Jia
Date Jan. 6, 2013, 8:34 a.m.
Message ID <2f2c14ff5bbe6619fd7ac1649f5f985604bd6941.1357354330.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/42031/
State New
Headers show

Comments

Hongxu Jia - Jan. 6, 2013, 8:34 a.m.
Add option -march to BUILD_CFLAGS in order to let the atomic operations
("lock free") be available while using old version GCC (4.3.4 for example)
on x86 host to compile glib-2.0-native.

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Colin Walters - Jan. 6, 2013, 6:28 p.m.
On Sun, 2013-01-06 at 16:34 +0800, Hongxu Jia wrote:

> +# Add option -march to BUILD_CFLAGS in order to let the atomic operations
> +# ("lock free") be available while using old version GCC on x86 host to
> +# compile glib-2.0-native
> +BUILD_CFLAGS += "-march=${@'${BUILD_ARCH}'.replace('_','-')}"

Shouldn't this be handled more generically for all native recipes?
Hongxu Jia - Jan. 9, 2013, 8:23 a.m.
On 01/07/2013 02:28 AM, Colin Walters wrote:
> On Sun, 2013-01-06 at 16:34 +0800, Hongxu Jia wrote:
>
>> +# Add option -march to BUILD_CFLAGS in order to let the atomic operations
>> +# ("lock free") be available while using old version GCC on x86 host to
>> +# compile glib-2.0-native
>> +BUILD_CFLAGS += "-march=${@'${BUILD_ARCH}'.replace('_','-')}"
> Shouldn't this be handled more generically for all native recipes?
>
>
Hi Colin,

I have a fully test and the qemu-native has the similar problem, and I will
resend the patch.

It's a bad idea to modify bitbake.conf to add option -march to BUILD_CFLAGS,
because it's global and its side effect is unknown, such as beecrypt-native
do_compile will fail if we do that.

So it's best to test most of the native recipes to have a check about 
the similar
problem and fix them separately, and the packagegroup-toolset-native.bb
could work for that.

Regards,
Hongxu

Patch

diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
index 9854585..07d16bd 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.34.3.bb
@@ -1,6 +1,6 @@ 
 require glib.inc
 
-PR = "r0"
+PR = "r1"
 PE = "1"
 
 DEPENDS += "libffi python-argparse-native zlib"
@@ -38,6 +38,10 @@  RDEPENDS_${PN}-ptest += "\
             python-pygobject \
             python-dbus \
            "
+# Add option -march to BUILD_CFLAGS in order to let the atomic operations
+# ("lock free") be available while using old version GCC on x86 host to
+# compile glib-2.0-native
+BUILD_CFLAGS += "-march=${@'${BUILD_ARCH}'.replace('_','-')}"
 
 do_configure_prepend() {
 	sed -i -e '1s,#!.*,#!${USRBINPATH}/env python,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in