Skip to contentSkip to conversation

native.bbclass: add (re)definitions for TARGET_SYS and HOST_SYS

PATCH In review Frans Meulenbroeks 4 participants 6 messages Aug 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 native.bbclass: add (re)definitions for TARGET_SYS and HOST_SYS

---

The issue at hand was discovered by setting TARGET_OS_local = "linux-gnuspe"
in my local.conf file as I needed to build for ppc e500 This caused configure of gmp-native to be called with --build=x86_64-linux --host=x86_64-linux --target=x86_64-linux-gnuspe which in turn caused configure to fail.
The odd thing is that for a native recipe I would expect that build host and target gets the same args.

The configure line comes from autotools.bbclass
which says:

CONFIGUREOPTS = " --build=${BUILD_SYS} \
                  --host=${HOST_SYS} \
                  --target=${TARGET_SYS} \

Apparently HOST_SYS and TARGET_SYS are not identical for native recipes Peeking into native.bbclass learned that things like TARGET_PREFIX and HOST_PREFIX are redefined, but TARGET_SYS and HOST_SYS are not.

This patch adds assignments to fix this.
I have tested this by building the image I am working on (which includes some low level stuff like kernel and u-boot, and also requires that lots of native recipes are build) No problem was detected during that test.

If TARGET_OS = "linux" this will not make any difference for you. If your TARGET_OS = "linux-gnuspe" like it is for me and your build system has "linux" as OS, a side effect of this change is that a rebuild is needed as the work dir will change from (in my case) x68_64-linux to x86_64-linux-gnuspe It might be that a full rebuild is needed in that case (haven't tested that case)

Frans

 classes/native.bbclass |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
classes/native.bbclass +2 -0
index 3437836..85c7cf1 100644
@@ -23,6 +23,7 @@ TARGET_VENDOR = "${BUILD_VENDOR}"
 TARGET_PREFIX = "${BUILD_PREFIX}"
 TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
 TARGET_EXEEXT = "${BUILD_EXEEXT}"
+TARGET_SYS = "${BUILD_SYS}"
 
 HOST_ARCH = "${BUILD_ARCH}"
 HOST_OS = "${BUILD_OS}"
@@ -30,6 +31,7 @@ HOST_VENDOR = "${BUILD_VENDOR}"
 HOST_PREFIX = "${BUILD_PREFIX}"
 HOST_CC_ARCH = "${BUILD_CC_ARCH}"
 HOST_EXEEXT = "${BUILD_EXEEXT}"
+HOST_SYS = "${BUILD_SYS}"
 
 CPPFLAGS = "${BUILD_CPPFLAGS}"
 CFLAGS = "${BUILD_CFLAGS}"
Signature · 1 line
1.7.0.4
#1 lore raw

classes/native.bbclass TARGET_VENDOR = "${BUILD_VENDOR}" · line 26

Quoted 5 lines · Frans Meulenbroeks
classes/native.bbclass +1 -0
@@ -23,6 +23,7 @@ TARGET_VENDOR = "${BUILD_VENDOR}"
 TARGET_PREFIX = "${BUILD_PREFIX}"
 TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
 TARGET_EXEEXT = "${BUILD_EXEEXT}"
+TARGET_SYS = "${BUILD_SYS}"

I don't think this is the right thing; native.bbclass already assigns TARGET_OS = "${BUILD_OS}".

Do you really need to use a _local override for TARGET_OS? If so then I guess you need to find a way to stop it applying for virtclass-native.

p.

#2 lore raw
Quoted 6 lines · Phil Blundell
Quoted 5 lines · Frans Meulenbroeks
(quoted diff) +0 -0
@@ -23,6 +23,7 @@ TARGET_VENDOR = "${BUILD_VENDOR}"

 TARGET_PREFIX = "${BUILD_PREFIX}"
 TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
 TARGET_EXEEXT = "${BUILD_EXEEXT}"
+TARGET_SYS = "${BUILD_SYS}"

bitbake.conf already has

TARGET_SYS=${TARGET_ARCH}${TARGET_VENDOR}${@['-' + bb.data.getVar('TARGET_OS', d, 1), ''][bb.data.getVar('TARGET_OS', d,
1) == ('' or 'custom')]}

so once you have TARGET_OS set correctly this should work well for native too.

Quoted 16 lines

I don't think this is the right thing; native.bbclass already assigns TARGET_OS = "${BUILD_OS}".

Do you really need to use a _local override for TARGET_OS?  If so then I guess you need to find a way to stop it applying for virtclass-native.

p.

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

#3 lore raw
Quoted 10 lines · Khem Raj
Quoted 6 lines · Phil Blundell
Quoted 5 lines · Frans Meulenbroeks
(quoted diff) +0 -0
@@ -23,6 +23,7 @@ TARGET_VENDOR = "${BUILD_VENDOR}"

 TARGET_PREFIX = "${BUILD_PREFIX}"
 TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
 TARGET_EXEEXT = "${BUILD_EXEEXT}"
+TARGET_SYS = "${BUILD_SYS}"

bitbake.conf already has

Quoted 5 lines

TARGET_SYS=${TARGET_ARCH}${TARGET_VENDOR}${@['-' + bb.data.getVar('TARGET_OS', d, 1), ''][bb.data.getVar('TARGET_OS', d,
1) == ('' or 'custom')]}

so once you have TARGET_OS set correctly this should work well for native too.

hmm _local ok if you override TARGET_OS locally then lot of other things will change
because now TARGET_OS will not be reset to whatever native wants. even if you redefine TARGET_SYS may not be sufficient. Somehow if you can make native.bbclass
to stubbornly ignore TARGET_OS override that might work.

Quoted 18 lines
Quoted 17 lines

I don't think this is the right thing; native.bbclass already assigns TARGET_OS = "${BUILD_OS}".

Do you really need to use a _local override for TARGET_OS?  If so then I guess you need to find a way to stop it applying for virtclass-native.

p.

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

#4 lore raw

2010/8/20 Khem Raj <[email protected]>:

Quoted 18 lines · Khem Raj
Quoted 10 lines · Phil Blundell
Quoted 6 lines · Frans Meulenbroeks
Quoted 5 lines
(quoted diff) +0 -0
@@ -23,6 +23,7 @@ TARGET_VENDOR = "${BUILD_VENDOR}"

 TARGET_PREFIX = "${BUILD_PREFIX}"
 TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
 TARGET_EXEEXT = "${BUILD_EXEEXT}"
+TARGET_SYS = "${BUILD_SYS}"

bitbake.conf already has

Quoted 5 lines

TARGET_SYS=${TARGET_ARCH}${TARGET_VENDOR}${@['-' + bb.data.getVar('TARGET_OS', d, 1), ''][bb.data.getVar('TARGET_OS', d,
1) == ('' or 'custom')]}

so once you have TARGET_OS set correctly this should work well for native too.

Quoted 7 lines

hmm _local ok if you override TARGET_OS locally then lot of other things will change
because now TARGET_OS will not be reset to whatever native wants. even if you redefine TARGET_SYS may not be sufficient. Somehow if you can make native.bbclass
to stubbornly ignore TARGET_OS override that might work.

I don't want to override TARGET_OS (and in fact this could be done in the machine definition).

The hardware I am working with is a powerpc system quite similar to calamari. It is an e500v2 which supports/needs spe.
For calamari/angstrom things work by the grace of the following code in angstrom.eglibc.inc:

TARGET_OS = "linux"

TARGET_OS .= "${@['','-gnueabi'][bb.data.getVar('TARGET_ARCH',d,1) in ['arm', 'armeb']]}"
TARGET_OS .= "${@['','-gnuspe'][bb.data.getVar('TARGET_ARCH',d,1) in ['ppc', 'powerpc'] and bb.data.getVar('MACHINE',d) in ['calamari']]}"

and actually if I replace calamari with my machine name it works. The code seems too specific because afaik each ppc e500 core requires gnuspe.

The reason the override was there and not in the machine config, is because at some point I thought this inc file would mask my definition, so I wanted to be really really sure I got the gnuspe settings.
I've had a discussion on this with pb and RP on irc, the problem is probably not here but in gmp-native. Earlier native recipes (like openssl-native, libcurses-native etc etc) build fine but for gmp-native configure fails.
We've also looked at the patch for gmp-native and at least the darwin patch indicates there is something fishy here.
My "patch" fixed things for me, but as it stands it is probably not the proper solution but the answer is in gmp.
And my misperception was that for native recipes target and host should be the sam, but for gmp-native configure is called with

--build=x86_64-linux --host=x86_64-linux --target=x86_64-linux-gnuspe

and it barfs upon the target value. Is this target value ok??? As I said I expected here that build==host==target (for a native recipe).

Frans

PS: I'm doing a rebuild from scratch now with the patch undone and TARGET_OS being defined in the machine conf. When finished I can provide some more detailed info on the error.

#5 lore raw
Quoted 24 lines · Frans Meulenbroeks

2010/8/20 Khem Raj <[email protected]>:

Quoted 14 lines · Khem Raj
Quoted 13 lines · Phil Blundell
Quoted 6 lines · Frans Meulenbroeks

classes/native.bbclass TARGET_VENDOR = "${BUILD_VENDOR}" · line 26

Quoted 5 lines
classes/native.bbclass +1 -0
@@ -23,6 +23,7 @@ TARGET_VENDOR = "${BUILD_VENDOR}"
 TARGET_PREFIX = "${BUILD_PREFIX}"
 TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
 TARGET_EXEEXT = "${BUILD_EXEEXT}"
+TARGET_SYS = "${BUILD_SYS}"

bitbake.conf already has

TARGET_SYS=${TARGET_ARCH}${TARGET_VENDOR}${@['-' + bb.data.getVar('TARGET_OS', d, 1), ''][bb.data.getVar('TARGET_OS', d,
1) == ('' or 'custom')]}

Quoted 9 lines
Quoted 1 line

so once you have TARGET_OS set correctly this should work well for native too.

hmm _local ok if you override TARGET_OS locally then lot of other things will change
because now TARGET_OS will not be reset to whatever native wants. even if you redefine TARGET_SYS may not be sufficient. Somehow if you can make native.bbclass
to stubbornly ignore TARGET_OS override that might work.

Quoted 7 lines

I don't want to override TARGET_OS (and in fact this could be done in the machine definition).

The hardware I am working with is a powerpc system quite similar to calamari. It is an e500v2 which supports/needs spe.
For calamari/angstrom things work by the grace of the following code in angstrom.eglibc.inc:

In essence, Angstrom needs the logic compute_os_portion_of_target_triplet() in sane-toolchain.inc has, for doing -gnuspe if it's going to support PPC more widely.

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation