Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

When compiling modules with hundreds of .o files, ninja fails with posix_spawn: Argument list too long because command-line arguments exceed OS limits (~128KB).

Changes

New: scripts/compilation/fix_ninja_response_files.py

  • Post-processes IRPF90-generated ninja files to use response files (@file syntax)
  • Identifies link/archive rules by checking command lines for compiler keywords (gfortran, gcc, ar, etc.)
  • Replaces $in with @$out.rsp and adds rspfile/rspfile_content directives
  • Uses regex \$in(?=\s|$|[^a-zA-Z0-9_]) to avoid matching $include_dir and similar variables

Modified: scripts/compilation/qp_create_ninja

  • Calls post-processing script after IRPF90 runs
  • Uses && chaining to fail build if post-processing fails

Example

Before (causes error with many files):

rule link_fortran
  command = gfortran $in -o $out $LDFLAGS

After (uses response file):

rule link_fortran
  command = gfortran @$out.rsp -o $out $LDFLAGS
  rspfile = $out.rsp
  rspfile_content = $in_newline

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • gitlab.com
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Argument List too long</issue_title>
<issue_description>When I try co compile a new module, I get the following error message:

Link: irpf90.a ninja: fatal: posix_spawn: Argument list too long

It seems that a very long list of .o files is created in a build.ninja.
We need to modify the python scripts that build ninja files to solve this problem
</issue_description>

<agent_instructions>Only commit python scripts, avoid git commit *</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 6 commits January 5, 2026 16:01
Co-authored-by: scemama <5970658+scemama@users.noreply.github.com>
Co-authored-by: scemama <5970658+scemama@users.noreply.github.com>
Co-authored-by: scemama <5970658+scemama@users.noreply.github.com>
…mand chaining

Co-authored-by: scemama <5970658+scemama@users.noreply.github.com>
Co-authored-by: scemama <5970658+scemama@users.noreply.github.com>
…exact indentation

Co-authored-by: scemama <5970658+scemama@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix argument list too long error in ninja builds Fix "Argument list too long" error when linking modules with many object files Jan 5, 2026
Copilot AI requested a review from scemama January 5, 2026 16:15
@scemama scemama closed this Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Argument List too long

2 participants