[Scons-users] StaticLibrary problems
Mats Wichmann
mats at wichmann.us
Thu Aug 29 12:36:06 EDT 2024
On 8/29/24 05:07, Edwin H. Bielawski via Scons-users wrote:
> Hello,
>
> I have problems creating a static library with a large number of files.
> It seems that the list has to be completely passed via the command line, which Windows unfortunately acknowledges this with “line too long”.
Are you using GNU tools on Windows, then? SCons on Windows does have a
scheme for dealing with long command lines using temporary files to hold
file lists, but it doesn't trigger unless the Microsoft compiler chain
is in use.
> I can pass this to the GNU AR tool as a file, but this does not help because the object files are not generated if they are not specified within the command.
> env.StaticLibrary("mylib", ['main.cpp'])
>
> Are there any workarounds?
Not sure.
GNU ar can operate incrementally, but I don't think the SCons
StaticLibrary builder knows how to do that, nor does it know about the
@file syntax, nor does it know about --thin.
Part of the problem you can maybe solve by breaking it into steps: use
StaticObject() to cause the object files equivalent to StaticObject's
sources to be entered into the dependency graph, and then pass those to
an action that turns the names of those objects into the file list, and
then make a call to the archiver to build the library using the correct
syntax. That final step may need to be a Command() call, or it may be
possible to fiddle the construction variables (like $ARCOM) to make
StaticLibrary do that.
Somebody else probably has done this and has better ideas....
More information about the Scons-users
mailing list