[Scons-users] separation of behavior between building objects for shared libs and for executables

Andrew C. Morrow andrew.c.morrow at gmail.com
Sat Jun 17 11:52:37 EDT 2017


Hi Bill -

Yes, added PROGCXXFLAGS and a host of others.

The thing is, I'm not sure our technique is generally applicable. We are
assuming that anything that is built into a .a is destined for an
executable, which is true in our codebase, but maybe not in others.

I agree with the original author though that it is tricky to get ASLR
builds correct with SCons. It isn't something that works out of the box.

Thanks,
Andrew


On Fri, Jun 16, 2017 at 11:18 AM, Bill Deegan <bill at baddogconsulting.com>
wrote:

> Andrew,
>
> Did you also add PROGCXXFLAGS?
>
> -Bill
>
> On Fri, Jun 16, 2017 at 7:26 AM, Andrew C. Morrow <
> andrew.c.morrow at gmail.com> wrote:
>
>>
>> MongoDB took a different approach. We added PROGCCFLAGS to allow us to
>> use different flags for objects intended for binaries, rather than shared
>> libraries:
>>
>> - https://github.com/mongodb/mongo/blob/cde889643b317ee0e8cb4f
>> a72a4dbc162c75bb1c/SConstruct#L1302-L1310
>> - https://github.com/mongodb/mongo/blob/cde889643b317ee0e8cb4f
>> a72a4dbc162c75bb1c/SConstruct#L1581-L1591
>>
>> I believe there is some older discussion here in SCons users as well, if
>> you search the archives for PROGCCFLAGS.
>>
>> Thanks,
>> Andrew
>>
>>
>> On Thu, Jun 15, 2017 at 10:17 PM, Bill Deegan <bill at baddogconsulting.com>
>> wrote:
>>
>>> There are some reasonable examples in the users guide and in the wiki.
>>>
>>> Generally, a top level SConstruct, and then per source dir SConscript.
>>> The top level may set up the Environment()(s) which you use and then
>>> pass them to the SConscripts.
>>> Also using variant_dir arg in SConscript() will allow you to create
>>> different variants (release/debug/other) and keep the built files (objects,
>>> libraries,programs,etc) in different directories than the source files.
>>>
>>> Does that help answer your questions?
>>>
>>> -Bill
>>>
>>> On Thu, Jun 15, 2017 at 4:50 PM, Mats Wichmann <mats at wichmann.us> wrote:
>>>
>>>> On 06/15/2017 02:18 PM, Bill Deegan wrote:
>>>> > You can create several Environment()'s with different settings, or
>>>> you can
>>>> > specify the flags on env.Program(), or env.SharedObject(), or
>>>> > env.Object(),etc...
>>>> >
>>>> >
>>>> > What is your goal? (1000 foot view)
>>>> > Start with that, rather than if I do this thing will it do this other
>>>> thing?
>>>>
>>>> Goal? at this point, understanding (I'm learning by way of a project
>>>> which has grown organically with lots of essentially drive-by
>>>> contributions, as opposed to learning by building something from
>>>> scratch)
>>>>
>>>> I guess to see if it makes sense to build shared libraries and
>>>> executables (and other things which need "special treatment", like unit
>>>> tests, which might need linking with a testing library) from the same
>>>> sconscript, or if they should be separated into directories which have
>>>> their own scripts. I know "lump it together or separate things into
>>>> directories" is more philosophy than requirements.  And it sounds like
>>>> existing facilities such as different-environments-for-different-things
>>>> are probably sufficient to adapt either way.
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170617/2a895818/attachment.html>


More information about the Scons-users mailing list