How can I use the GCC -frandom-seed=<file name> option with the waf build system?
Chris Johns
chrisj at rtems.org
Mon Sep 26 00:08:17 UTC 2022
On 24/9/2022 5:03 am, Sebastian Huber wrote:
> On 23/09/2022 20:27, Joel Sherrill wrote:
>>
>>
>> On Fri, Sep 23, 2022 at 11:49 AM Sebastian Huber
>> <sebastian.huber at embedded-brains.de
>> <mailto:sebastian.huber at embedded-brains.de>> wrote:
>>
>> On 23/09/2022 18:47, Karel Gardas wrote:
>> > On 9/23/22 18:35, Sebastian Huber wrote:
>> >> Hello,
>> >>
>> >> I have a question for the waf experts. How can I use the GCC
>> >> -frandom-seed=<file name> option with the waf build system?
>> >>
>> >>
>>
>> https://stackoverflow.com/questions/73829827/how-can-i-use-the-gcc-frandom-seed-file-name-option-with-the-waf-build-system <https://stackoverflow.com/questions/73829827/how-can-i-use-the-gcc-frandom-seed-file-name-option-with-the-waf-build-system>
>> >
>> > Unix? Why not to use pure and simple -frandom-seed=$RANDOM ? E.g.
>> I hope
>> > you'd like to have something there hence went for file name which
>> will
>> > give you stable "random" value per every file compiled while $RANDOM
>> > will give you more randomness and certainly not the same value
>> per same
>> > file...
>>
>> I would like to have a reproducible build, so I don't want something
>> which varies across builds.
>>
>>
>> Why not just pass in a constant? You need it to be the same so waf
>> reacts the same.
>
> The GCC documentation says:
>
> The string should be different for every file you compile.
>
I suppose you could create a separate `bld()` instance for each file and
explicitly add the flags if you have control at that level?
If you want it to be cleaver and automatic you would need to look at the "c c++"
tools and those features and how to hook into the flow to inject the extra
option. Options are part of the dependency signature so option changes result in
a rebuild so you would need to consider that. I would need to play around to see
how this would fit.
Chris
More information about the devel
mailing list