Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use response files for ghc invocations #9367

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Nov 19, 2024

  1. Use response files for ghc invocations

    Before this change, `cabal` could fail with the following error message
    when building very large Haskell packages:
    
    ```
    ghc: createProcess: posix_spawnp: resource exhausted (Argument list too long)
    ```
    
    This is because when the number of modules or dependencies grows large
    enough, then the `ghc` command line can potentially exceed the
    `ARG_MAX` command line length limit.
    
    However, `ghc` supports response files in order to work around these
    sorts of command line length limitations, so this change enables the
    use of those response files.
    
    Note that this requires taking a special precaution to not pass RTS
    options to the response file because there's no way that `ghc` can
    support RTS options via the response file.  The reason why is because
    the Haskell runtime processes these options (not `ghc`), so if you
    store the RTS options in the response file then `ghc`'s command line
    parser won't know what to do with them.
    
    This means that `ghc` commands can still potentially fail if the RTS
    options get long enough, but this is less likely to occur in practice
    since RTS options tend to be significantly smaller than non-RTS
    options.
    
    This also requires skipping the response file if the first argument
    is `--interactive`.  See the corresponding code comment which explains
    why in more detail.
    
    Co-Authored-By: Gabriella Gonzales <[email protected]>
    9999years and Gabriella439 committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    2f72704 View commit details
    Browse the repository at this point in the history