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

Peter Kjellerstedt peter.kjellerstedt at axis.com
Fri Nov 8 15:51:15 UTC 2013


You may want to take a look at "meta/conf/distro/include/security_flags.inc". I think it does what you are looking for

//Peter

From: bitbake-devel-bounces at lists.openembedded.org [mailto:bitbake-devel-bounces at lists.openembedded.org] On Behalf Of Udayan Bapat
Sent: den 8 november 2013 14:53
To: bitbake-devel at lists.openembedded.org
Subject: [bitbake-devel] How to strip CFLAGS in the recipe file?

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','')}<mailto:$%7b@'$%7bCFLAGS%7d'.replace('-fPIE','')%7d>"

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','')}<mailto:$%7b@'$%7bCFLAGS%7d'.replace('-fPIE','')%7d>"
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/47c8b0f1/attachment-0002.html>


More information about the bitbake-devel mailing list