[Scons-users] Cyclic references between lib archives

Dirk Bächle tshortik at gmx.de
Wed Feb 4 17:33:30 EST 2015

On 04.02.2015 23:20, Ivan Kravets wrote:
>> [...]
> Hm... I don't like to change "core logic" in the 3-rd party tool, like SCons. I prefer to use "PUBLIC" access, without modifying "PRIVATE" field.
> If I will modify "LINCOM" variable, then the only one working solution is add "cyclic" libs before _LIBFLAGS:
>      src.Prepend(
>          _LIBFLAGS="-Wl,--start-group $STATIC_LIBS -Wl,--end-group "
>      )
> This works good!
> Tell me please, is it safe way?

SCons is setting up an Environment for you with default values, and you're always free to change the available env vars afterwards. 
As long as it works for you, it's allowed. ;)
If you're concerned about overwriting your "base" environment, either Clone() it and work on a copy (e.g. staticLibEnv = 
env.Clone()), or use the feature of appending variable overrides to your Builder call:

   env.Program('myexe', Glob('*.c'), _LIBFLAGS = '-Wl,--start-group $STATIC_LIBS -Wl,--end-group ' + env.subst('$_LIBFLAGS'))


More information about the Scons-users mailing list