haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.63k stars 697 forks source link

Windows/macOS max command line length being hit calling ghc #7075

Open dten opened 4 years ago

dten commented 4 years ago

Describe the bug on Windows with a large project cabal build fails with:

E:\sb\x86_64-windows\ghc-8.8.4\bin\ghc.exe: createProcess: does not exist (No such file or directory)

To Reproduce Steps to reproduce the behavior: Have a large project. i made a repro here https://github.com/dten/cabal-max-path-repro

on windows in that repo

cabal build -v

Build will fail, but first it outputs the command it's trying to run which is approxy 38k characters long, longer than limit that can be given to createProcess. the command is that long because it includes all module names and there's a lot of them

Removing the last 20 or so modules from the Cabal package takes it under the limit and it then builds. (technically depends on ghc path)

Please use version-prefixed commands (e.g. v2-build or v1-build) to avoid ambiguity. ^^ dunno what this means :)

Expected behavior A clear and concise description of what you expected to happen.

It should build

System information

Additional context I think this is the same issue as https://github.com/haskell/cabal/issues/3122 where the solution was to use response files.

I think from this issue that GHC does not support them though https://gitlab.haskell.org/ghc/ghc/-/issues/16476

ekmett commented 3 years ago

This is hitting me in https://github.com/ekmett/unboxed/tree/d8b073d162331d69eef7870f1a446d2e1c3d8159 if I build with -flevel2 on. There I spit out a very large number of backpack libraries and link them all together before reexporting many many modules.

Operating system: OSX cabal 3.4.0.0, ghc version 9.0.1

though admittedly the issues triggers at a much longer line length on OSX

$ getconf ARG_MAX
262144

If I spin up the library I run into ghc line length limits. This seems to be a joint cabal/ghc issue. in that ghc can't take its arguments in request files, and cabal can't pass it those arguments in such a file yet.

If I start the repl and need -fobject-code I run into clang line length limits. This seems like a direct ghc issue.

jneira commented 2 years ago

https://gitlab.haskell.org/ghc/ghc/-/issues/16476 has been milestoned to 9.6.1 recently :+1: