1) Issue When site-config-xxxx script (tobe included in SDK and referred by CONFIG_SITE in SDK environment) is generated, it is appended by HOST arch/os information instead of the TARGET arch/os information. 2) Symptom Yocto ver: jethro Host: x86_64 Target: arm (32bit) Build SDK, setting SDKMACHINE to x86_64. After SDK is generated, install it and source its environment-setup script. And if I invoke $CC (arm-poky-linux-gnueabi-gcc), using this SDK, sizeof (long) is 4 (long = int) However, if I look into $CONFIG_SITE's definition of ac_cv_sizeof_long, it is defined as '8'. I feel this is strange since if this cached configure data is for the target (and cross-compiling), this value should be 4, to match the above (arm-poky-linux-gnueabi-gcc) result. (I think this part of the cache is being copied from poky/meta/site/x86_64-linux, ) This is causing break if I build autotool based program using the SDK. 3) Analysis If I look into toolchain-scripts.bbclass, I can see toolchain_create_sdk_siteconfig is gathering site-config information from the following two lists: 1) TOOLCHAIN_CONFIGSITE_NOCACHE 2) TOOLCHAIN_NEED_CONFIGSITE_CACHE 2) Seems to be OK, since it is getting the sitefiles from the target files. However, 1) is gathering the sitefiles by calling siteinfo_get_files(). If I look into siteinfo_get_files(), it returns information on HOST_ARCH-HOST_OS pair (here, I think HOST_ARCH-HOST_OS is not that of my target machine but my x86_64 HOST) In fact, if I debug bitbake behavior, I can see following files are actually appended as TOOLCHAIN_CONFIGSITE_NOCACHE files. xxx/meta-oe/site/endian-little xxx/poky/meta/site/endian-little xxx/poky/meta/site/ix86_common xxx/poky/meta/site/common-linux xxx/poky/meta/site/common-glibc xxx/poky/meta/site/common I think for toolchain_create_sdk_siteconfig(), TARGET_ARCH-TARGET_OS pair should be used to generate this list. (toolchain-scripts.bbclass excerpt) #we get the cached site config in the runtime TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d, True)}" TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d" TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses" #This function create a site config file toolchain_create_sdk_siteconfig () { local siteconfig=$1 rm -f $siteconfig touch $siteconfig for sitefile in ${TOOLCHAIN_CONFIGSITE_NOCACHE} ; do cat $sitefile >> $siteconfig done #get cached site config for sitefile in ${TOOLCHAIN_NEED_CONFIGSITE_CACHE}; do # Resolve virtual/* names to the real recipe name using sysroot-providers info case $sitefile in virtual/*) sitefile=`echo $sitefile | tr / _` sitefile=`cat ${STAGING_DIR_TARGET}/sysroot-providers/$sitefile` esac if [ -r ${TOOLCHAIN_CONFIGSITE_SYSROOTCACHE}/${sitefile}_config ]; then cat ${TOOLCHAIN_CONFIGSITE_SYSROOTCACHE}/${sitefile}_config >> $siteconfig fi done }
Moving to oe-core domain
I was able to reproduce the problem with the following configuration: (poky repository) git checkout jethro . ./oe-init-build-env MACHINE="qemuarm" SDKMACHINE="x86_64" bitbake -c populate_sdk core-image-minimal Inspecting the site config file: ac_cv_sizeof_long=${ac_cv_sizeof_long=8} ac_cv_sizeof_unsigned_long=${ac_cv_sizeof_unsigned_long=8}
Further info, the siteconfig file is generated as part of the recipe: meta-environment The meta-environment is an SDK package, not a target package -- so it gets the wrong siteconfig
I've verified. master is also broken in the same way.
commit 725e66e1d08ae000d8f68455ddca0e192080dc1f Author: Chen Qi <Qi.Chen@windriver.com> Date: Mon Sep 26 11:20:28 2016 +0800 meta-environment: ensure corret TOOLCHAIN_CONFIGSITE_NOCACHE value Expand TOOLCHAIN_CONFIGSITE_NOCACHE value immediately before inheriting cross-canadian to avoid HOST_ARCH being changed from TARGET_ARCH to SDK_ARCH, thus ensuring its correct value. [YOCTO #10255] (From OE-Core rev: 1e13d1fd22186af5544e7248dc12635cd2f2e08b) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>