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

Peter Kjellerstedt peter.kjellerstedt at axis.com
Fri Nov 8 19:19:33 UTC 2013


To be honest, I have not used it myself, I only knew it existed. But I suppose including it from local.conf should work. And it is probably better to add on it rather than inventing your own solution.

//Peter

From: Udayan Bapat [mailto:uvbapat at gmail.com]
Sent: den 8 november 2013 19:49
To: Peter Kjellerstedt
Subject: Re: [bitbake-devel] How to strip CFLAGS in the recipe file?

Hi Peter,

Thanks for the reply. Just to clarify, are you suggesting me to use this file instead of adding my own implementation of -fPIE and try to override it? If so,  do I include this file in local.conf to build different packages with appropriate settings?

On Fri, Nov 8, 2013 at 10:51 AM, Peter Kjellerstedt <peter.kjellerstedt at axis.com<mailto:peter.kjellerstedt at axis.com>> wrote:
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> [mailto: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<mailto: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/79f3a992/attachment-0002.html>


More information about the bitbake-devel mailing list