Bug 11874

Summary: override TARGET_* flags
Product: [Build System, Metadata & Runtime] OE-Core Reporter: betacentauri
Component: coreAssignee: Richard Purdie <richard.purdie>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, randy.macleod, stephano
Version: unspecified   
Target Milestone: 2.7 M1   
Hardware: x86   
OS: Multiple   
Whiteboard: backport 2.4.3?
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description betacentauri 2017-07-29 11:39:14 UTC
Hi,

I have a problem with these 4 commits:
http://git.openembedded.org/openembedded-core/commit/?id=55c83cb239df5faf5e2143fffca47f2f16931cb3
http://git.openembedded.org/openembedded-core/commit/?id=3facbe700a2f28a11620c4954686ed5d5e47a3d9
http://git.openembedded.org/openembedded-core/commit/?id=85b69a5ec9ba9ea9ebdcd8ac18e1e147ddb1ff33
http://git.openembedded.org/openembedded-core/commit/?id=767335c92b7cc657a008722a908380a3c89c3c66

The TARGET_ variables are used for building for the target system. The BUILD_ variables are used for building for the build host. So is it correct to set TARGET_* to BUILD_*?

I found the commits because my build failed:
...
| checking for suffix of object files... configure: error: in `/mnt/build/oe-a/build-env_next/builds/openatv/release/sf4008/tmp/work/x86_64-linux/gcc-cross-initial-arm/7.1.0-r0/gcc-7.1.0/build.x86_64-linux.arm-oe-linux-gnueabi/arm-oe-linux-gnueabi/libgcc':
| configure: error: cannot compute suffix of object files: cannot compile
| See `config.log' for more details.
| make: *** [configure-target-libgcc] Error 1
| ERROR: oe_runmake failed
| WARNING: /mnt/build/oe-a/build-env_next/builds/openatv/release/sf4008/tmp/work/x86_64-linux/gcc-cross-initial-arm/7.1.0-r0/temp/run.do_compile.20019:1 exit 1 from 'exit 1'
| ERROR: Function failed: do_compile (log file is located at /mnt/build/oe-a/build-env_next/builds/openatv/release/sf4008/tmp/work/x86_64-linux/gcc-cross-initial-arm/7.1.0-r0/temp/log.do_compile.20019)
ERROR: Task (/mnt/build/oe-a/build-env_next/openembedded-core/meta/recipes-devtools/gcc/gcc-cross-initial_7.1.bb:do_compile) failed with exit code '1'

In config.log this is visible:
cc1: error: unrecognized argument in option '-march=native'
cc1: note: valid arguments to '-march=' are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv5tej armv6 armv6-m armv6j armv6k armv6kz armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc armv8-m.base armv8-m.main armv8-m.main+dsp armv8.1-a armv8.2-a armv8.2-a+fp16 iwmmxt iwmmxt2

Why does it happen? Because I use this:
BUILD_OPTIMIZATION = "-march=native -O2 -pipe"

According to DOCS BUILD_OPTIMIZATION is used for "building for the build host or the SDK". So I think adding "-march=native" is ok.
And BUILD_OPTIMIZATION is added to the BUILD_CFLAGS in the bitbake.conf.
Comment 1 Richard Purdie 2018-10-31 22:41:47 UTC
http://git.openembedded.org/openembedded-core/commit/?id=55c83cb239df5faf5e2143fffca47f2f16931cb3

was reverted with:

http://git.yoctoproject.org/cgit.cgi/poky/commit/meta/classes/cross.bbclass?id=e824e093757c3de9c7c6194ff2ebab866dcfca2f

and I believe crosssdk needs the same fix.

The latter two changes using BUILD_SDK*FLAGS are correct though even if the variable is poorly named.
Comment 3 betacentauri 2018-11-10 07:58:18 UTC
Thanks, works like before.