Use @response_files.txt for linking in Ninja #4350
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Response files are a means to work around the limited command line length particularly on Windows (see #4342 (comment)). Instead of listing all to-be-linked object files on the command line, ninja will write them into a "response file" and address that in the command using the @something.txt syntax.
The problem of extremely long command line arguments becomes more pressing due to #4245 generating a build.ninja file with absolute paths to all involved object and source files when configuring
--with-build-dir=
.Essentially the "shared" link command goes from (25kB of command line arguments 😲):
.... to:
Note that this approach uses a feature in Ninja to temporarily generate the response file from data provided within
build.ninja
. This approach unfortunately isn't easily applied to Makefiles. We could create the response files directly inconfigure.py
but given its just a workaround for Windows users that require--with-build-dir=
the Ninja-only support might just be enough.