Open AndreasKempfNEC opened 7 years ago
Generators can use rspfile, rspfile_contents (https://ninja-build.org/manual.html#ref_rule) to make things go with very long command lines.
Looks like our error message could be better here though, so I'm leaving this open for that.
Hello,
I have some troubles regarding this error
posix_spawn: Argument list too long 07:12:24 ninja failed with: exit status 1
Any solution for Ubuntu 20.04?
Thanks in advance
So, did anyone figure this out yet?
[0/8662] Compiling Vala source ../src/<REDACTED>
ninja: fatal: posix_spawn: Argument list too long
I am also facing same kind of issue. Any solution?
Dear Ninja team,
(edit: damn, I should have used the search function. It seems that this is a known issue: https://github.com/ninja-build/ninja/pull/520 https://github.com/ninja-build/ninja/issues/53 So should this be fixed in Meson, then?)
while trying to port a large codebase (> 10000 files) to the Meson build system on Linux, I noticed that really long build lines can fail without providing an error message explaining the problem. This can easily be replicated by, e.g., the following (useless) Ninja build file with files main.c and test.c:
More specifically, it seems to fail with line lengths longer than around 128 kiB. Having done some digging, I suspect that Ninja hits the MAX_ARG_STRLEN limit of the Linux kernel [1, 2, 3],
Without really knowing too much about the Ninja source, I would suspect the following lines to cause this,
https://github.com/ninja-build/ninja/blob/9e71431e6f8323be8ced8997409cfe7a389c6583/src/subprocess-posix.cc#L103
It seems that the build line is passed to /bin/sh as a single command line argument. As explained above, this might hit a limit at some point.
Is this analysis correct? If so, do I have to work around this limitation somehow or could this be changed in a future Ninja version? If I understand correctly, the argument will have to be split, or the options will have to be passed via STDIN for really long commands to work.
[1] https://www.in-ulm.de/~mascheck/various/argmax/ [2] http://lxr.free-electrons.com/source/include/uapi/linux/binfmts.h#L14 [3] short test: