It looks as though the default GCC configuration in ADT 1.2 with Denzil (Yocto 1.2) does not support static linking out of the box. Is this a known issue or intended behavior? # echo $CXX i586-poky-linux-g++ # echo $CXXFLAGS -m32 -march=i586 --sysroot=/root/test-yocto/x86 # $CXX $CXXFLAGS -static hello.c /opt/poky/1.2/sysroots/i686-pokysdk-linux/usr/libexec/i586-poky-linux/gcc/i5 86-poky-linux/4.6.4/ld: cannot find -lstdc++ /opt/poky/1.2/sysroots/i686-pokysdk-linux/usr/libexec/i586-poky-linux/gcc/i5 86-poky-linux/4.6.4/ld: cannot find -lm /opt/poky/1.2/sysroots/i686-pokysdk-linux/usr/libexec/i586-poky-linux/gcc/i5 86-poky-linux/4.6.4/ld: cannot find -lc collect2: ld returned 1 exit status
This is due to we are lacking static library files (.a) in the images that used to extracted as sysroot, e.g. sato-sdk
Which sysroot are you using and are you expecting all static libraries includes? Is this needed for 1.2 or can you work with 1.3 master?
Moving to 1.3. Do we need some mechanism to include staticdev packages in sdk images? I'd imagine this is a consequence of the more granular packaging. This should probably be looked at in the context of the other -dbg, -dev and -doc package bugs currently open...
Patches are now out on the OE-core list for review on this one (for merging into M3 rather than M2). They add a "staticdev-pkgs" IMAGE_FEATURES feature so that these packages can be optionally added.
Implemented in the following revisions: fa5640d143beea4be101d6622d3fa133d04272f2 98b0f956e7d16c2791cc00dbb75187b886e4cbcd
Reopening since I could reproduce with http://autobuilder.yoctoproject.org/pub/nightly/20120916-2/toolchain/i686/poky-eglibc-i686-i586-toolchain-gmae-1.2+snapshot-20120916.sh [yocto@vostro2 tmp]$ $CXX $CXXFLAGS -static compile.cpp /home/yocto/tmp/x86/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-ld: cannot find -lstdc++ /home/yocto/tmp/x86/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-ld: cannot find -lm /home/yocto/tmp/x86/sysroots/x86_64-pokysdk-linux/usr/bin/i586-poky-linux/i586-poky-linux-ld: cannot find -lc collect2: error: ld returned 1 exit status [yocto@vostro2 tmp]$
I was told we would not add these files by default, we would just provide the option to add them, which I have done. Jessica, what would you like to do here?
Yes, as long as we provide the mechanism to add them, we don't want to explode the image by adding them by default
OK, in that case I'll mark this as resolved again.
Hi, I am reopening this because the static libraries are not installed in the sysroot of the standalone toolchain, built using the staticdev-pkgs option. My investigation: 1. In order to have an image with static libraries, in local.conf the parameter "staticdev-pkgs" needs to be added as an extra image feature: EXTRA_IMAGE_FEATURES = "debug-tweaks staticdev-pkgs" 2. Building and extracting the standalone toolchain (bitbake meta-toolchain-sdk) using this option does no add the *.a files under its sysroot libraries. 3. Instead, after building a core-image-sato-sdk qemu tarball image (using the same local.conf file as point 2.) and extracting it using runqemu-extract-sdk I could find the *.a files located in /usr/lib/ directory of that image. So basically I believe there is a problem when the standalone toolchain is created (bitbake meta-toolchain-sdk). tested with: "master:78983e939ab17f02f8911c8b0d0e326b419856b9"
It is not mentioned here but you need to set SDKIMAGE_FEATURES not (EXTRA_)IMAGE_FEATURES; meta-toolchain-sdk is not an image and therefore does not use the latter variables.
Hi Paul, I have tried again only with: SDKIMAGE_FEATURES = "staticdev-pkgs ". Build the toolchain with meta-toolchain-sdk. Again, I have the same errors :(. Is there something wrong with my configuration? Also, the static libraries should be available in the toolchain aswell, right? Regards, Alex.
So, you're right, looking again at this more closely it has only been implemented in a form that works for images; i.e. either for the images themselves with (EXTRA_)IMAGE_FEATURES or with SDKIMAGE_FEATURES for creating an SDK for an image (i.e. when you run bitbake -c populate_sdk name-of-image). I'm not sure whether being able to add the staticdev packages easily to meta-toolchain-sdk was intended to be part of this task. If it is I would suggest creating a new bug rather than reopening this one as it is a non-trivial extension.
Ok Paul, I will open a new bug. Thank you for your help, Alex.
Hi, I have opened https://bugzilla.yoctoproject.org/show_bug.cgi?id=3441 for toolchain specific.