[Scons-users] Workaround/support for -Wl,--whole-archive

Jay West jhdub23 at gmail.com
Tue May 9 21:36:30 EDT 2017


Previous workarounds for scons lack of support for -Wl,--whole-archive was
to use LINKFLAGS and manually add dependencies for all files listed in
LINKFLAGS.  While this works, having to generate the LINKFLAGS and having
to carefully manage the dependencies is a pain.

Here is an alternate method.  Add the following to your scons file:

whole_archive = env.Command('-Wl,--whole-archive', [], '')
no_whole_archive = env.Command('-Wl,--no-whole-archive', [], '')



Now you can wrap the necessary libraries with
whole-archive/no-whole-archive in any combination. Example:

so_libs = env.SharedLibrary('myso',
whole_archive+['libfoo1.a']+no_whole_archive+['libbar.a']+whole_archive+['libfoo2.a']+no_whole_archive)



Are there any plans for scons to support -Wl,--whole-archive natively?

Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170509/10562e5e/attachment.html>


More information about the Scons-users mailing list