-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Long build line can hit MAX_ARG_STRLEN on Linux #1261
Comments
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 failed to build some targets (4 seconds)Any solution for Ubuntu 20.04? Thanks in advance |
So, did anyone figure this out yet?
|
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:
#520
#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,
ninja/src/subprocess-posix.cc
Line 103 in 9e71431
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:
The text was updated successfully, but these errors were encountered: