[bitbake-devel] How to strip CFLAGS in the recipe file?

Udayan Bapat uvbapat at gmail.com
Fri Nov 8 13:52:32 UTC 2013


Hi all,

I have a Yocto build environment where I intend to build all recipes with
-fPIE flag. So I have added CFLAGS_append += '-fPIE' in the local.conf.
However since shared libraries can not be built using -fPIE flag, I would
like to remove it from some recipes.

So far I have tried this in .bb files -

CFLAGS_noPIE = "${@'${CFLAGS}'.replace('-fPIE','')}"

do_compile_prepend () {
    CFLAGS = "${CFLAGS_noPIE}"
}

This throws an error -

*/zlib-native/1.2.8-r0/temp/run.do_compile.23159: line 82: CFLAGS: command
not found

I also have tried -

CFLAGS = "${@'${CFLAGS}'.replace('-
fPIE','')}"

This doesn't work because same variable can not be referenced twice.

Then I tried this -

CFLAGS_noPIE = "${@'${CFLAGS}'.replace('-fPIE','')}"
CFLAGS = "${CFLAGS_noPIE}"

This fails with an error "maximum recursion depth exceeded for variable
'CFLAGS'"

What is the correct way to doing this?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20131108/dc610fb6/attachment-0002.html>


More information about the bitbake-devel mailing list