Re: Changing HOST_CC_ARCH temporarily in recipe


Mikko Rapeli
 

Hi,

On Wed, Sep 18, 2019 at 11:26:29AM +0300, Damien LEFEVRE wrote:
Hi,

I have a package which requires to first build a x64 binary which is then
used to compile the target platform binaries.

The way I got away with it was to build that host binary from
do_configure_prepend() and then continue with the build procedure.

I recently upgraded to GCC7 + warrior and now building the host binary
from do_configure_prepend fails due to this error:
testCCompiler.c:1:0: error: bad value (armv8-a+crc) for -march= switch

I figured that the arch switch (building for tegra) is defined
in HOST_CC_ARCH as:
-march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat
-Wformat-security -Werror=format-security

If I clear HOST_CC_ARCH in my recipe file, do_configure_prepend succeeds
but of course the rest of the build will fail.

So i'm trying to do something like this:
do_configure_prepend(){
export HOST_CC_ARCH_BACKUP="${HOST_CC_ARCH}"
HOST_CC_ARCH=""
echo "HOST_CC_ARCH before cmake: ${HOST_CC_ARCH}"
CC="${BUILD_CC}" CXX="${BUILD_CXX}" CCFLAGS="${BUILD_CFLAGS}"
CXXFLAGS="${BUILD_CPPFLAGS} -std=c++11" LDFLAGS="${BUILD_LDFLAGS}" cmake
${S}
make
HOST_CC_ARCH="${HOST_CC_ARCH_BACKUP}"
}

There I still get:
HOST_CC_ARCH before cmake: -march=armv8-a+crc -fstack-protector-strong
-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security

So HOST_CC_ARCH doesn't get updated.

How can I temporarily reset HOST_CC_ARCH?
Only clean way to do this is to split the recipe into two parts:

* native for the build time tooling

* target for the target only build, which depends on the native build
time tooling

Everything else is a hack :)

Hope this helps,

-Mikko

Join yocto@lists.yoctoproject.org to automatically receive all group messages.