For anyone who ends up with an "argument list too long" error when trying to build Android: run ulimit -s 9999999 first. The maximum command line size on Linux is a percentage of the stack size ulimit.
I'm curious whether this is just an oversight in the build script. I recently ran into the "argument list too long" issue with my shell, and it was because I was using subshells instead of named pipes.
"Oversight" is a very kind way of putting "they NIH'd an utterly hideous build system just because they couldn't be bothered to understand how good existing ones are supposed to work".
like android is pretty much the only build system i know where even just *starting* a build makes your system mostly unresponsive for the next 20 or so minutes
AOSP build system is ninja, and that's not my experience with it. It chooses the number of jobs based on the number of hardware threads by default rather than opting in, so if you're comparing to using 1 thread that's relevant. CPU cgroup + SCHED_BATCH helps with this in general.
i need to add my specs to that:
7200rpm hard disk, 8GB of DDR3 RAM, 8 core CPU
The ninja part is not a problem at all actually, but when you start a build it has to convert all of the makefiles and bp files into a ninja file which takes *ages*
some of the linking steps require even more memory but that's unrelated to the build system (aside from the fact that the build system does not execute linking steps serially)
I definitely wouldn't want it to serialize anything. I've already lost an enormous amount of time waiting for builds. If you want to use fewer jobs, you do have that option, and with 8GB of memory I don't think you can safely get away with more than 1-2 especially due to LTO.
I'm not aware of a build system that would go out of the way to serialize things like linking. The make-based build system didn't do that, and the jack compiler used far more memory than anything in the current builds. Peak memory usage now is from the Clang LTO needed for CFI.
it only allows you to build everything in parallel or nothing in parallel, you would have to stop the build when it hits the linking phase and restart it with -j1