Bug 5078

Summary: Populate_sdk does not build correct cross toolchain for arm.
Product: [Build System, Metadata & Runtime] BitBake Reporter: Navani <navani.srivastava>
Component: bitbakeAssignee: Laurentiu Palcu <laurentiu.palcu>
Status: RESOLVED INVALID QA Contact:
Severity: major    
Priority: Medium+ CC: liezhi.yang, navani.srivastava, poky.bs.watcher, poky.watcher, Qi.Chen, sgw
Version: 1.3.2   
Target Milestone: 1.5 M5   
Hardware: Other   
OS: arm   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Local Configuration of Build none

Description Navani 2013-08-30 06:19:43 UTC
Created attachment 1448 [details]
Local Configuration of Build

I am trying to build SDK and required BSP images for arm1136 architecture.
I used qemuarm.conf as machine configuration file. Attached is local configuration file for build. 
Mentioned below are the steps I did to generate SDK and images.

I issued 
"bitbake -v core-image-minimal" which built all BSP images necessary to bootup the system. I tried them on board, they worked fine.

then I issued
"bitbake -c populate_sdk -v core-image-minimal"
Successfully generated SDK (poky-eglibc-i686-arm-toolchain-1.3.2.sh) but at the time of cross compiling test file, ended up with following error-

/opt/poky/1.3.2/sysroots/i686-pokysdk-linux/usr/bin/armv6-vfp-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc test.c
test.c:3:19: fatal error: stdio.h: No such file or directory

To verify configuration I build SDK by issuing
"bitbake -v meta-toolchain"
Again I built SDK (poky-eglibc-i686-arm-toolchain-1.3.2.sh) and tried compiling the same code. It worked.

Seems to be problem with populate_sdk option of bitbake.
Comment 1 Saul Wold 2013-08-30 23:45:10 UTC
I can reproduce this with 1.5 also in master, so it will get there first and possibly back ported.
Comment 2 Robert Yang 2013-09-02 12:23:08 UTC
I can't reproduce this error on master, maybe I missed something.
Comment 3 Saul Wold 2013-09-03 19:06:49 UTC
The compiler needs to be run with the --sysroot option, I was able to reproduce this with master using meta-toolchain also.  This is something that we should consider for 1.6.

Please confirm if the --sysroot option works.
Comment 4 Navani 2013-09-04 05:10:42 UTC
What do you mean by "The compiler needs to be run with the --sysroot option".
Do you mean at the time of building cross toolchain with "populate_sdk", we have to provide some option?
Comment 5 Navani 2013-09-04 05:11:35 UTC
(In reply to comment #3)
> The compiler needs to be run with the --sysroot option, I was able to
> reproduce this with master using meta-toolchain also.  This is something
> that we should consider for 1.6.
> 
> Please confirm if the --sysroot option works.

(In reply to comment #3)
> The compiler needs to be run with the --sysroot option, I was able to
> reproduce this with master using meta-toolchain also.  This is something
> that we should consider for 1.6.
> 
> Please confirm if the --sysroot option works.

What do you mean by "The compiler needs to be run with the --sysroot option".
Do you mean at the time of building cross toolchain with "populate_sdk", we have to provide some option?
Comment 6 Laurentiu Palcu 2013-09-11 06:47:14 UTC
Hi Navani,

The correct procedure to build an app using the cross-toolchain is this:
1. source the environment script first. This will set some environment variables like CC, CXX, LDFLAGS, CFLAGS which will contain the correct options and flags for the compiler in order to build for your CPU;

source environment-setup-armv5te-poky-linux-gnueabi

2. Then use $CC to build your app, like so:

$CC -o test test.c

This is just a simple example. In complex makefiles you'll have to make sure to properly use the environment variables (CC, CFLAGS, LDFLAGS, etc.).

Marking the bug as INVALID since it works just fine. If you still encounter issues, feel free to reopen it and fill in as many details as possible.
Comment 7 Navani 2014-10-08 10:04:51 UTC
Hi Laurentiu,

$CC just worked fine the way you said. In case of cross compiling Qt project files with the help of qmake, am I supposed to define a new Path in environment-setup-armv5te-poky-linux-gnueabi which can route me to qmake location of SDK? or do we have a existing method to do so?
Comment 8 Navani 2014-10-08 10:05:51 UTC
Hi Laurentiu,

$CC just worked fine the way you said. In case of cross compiling Qt project files with the help of qmake, am I supposed to define a new Path in environment-setup-armv5te-poky-linux-gnueabi which can route me to qmake location of SDK? or do we have a existing method to do so?