On Sun, Feb 2, 2025 at 8:31 PM Geeta Dora via Gcc-bugs <gcc-b...@gcc.gnu.org> wrote: > > Dear GCC Developers, > > I encountered an issue where GCC fails to compile when the total > command-line argument > size exceeds 128KB. > > In contrast, Clang can handle the same compilation scenario without issues. > > Is this a known limitation in GCC, and are there any workarounds or plans > to address this? > Would response files (e.g., @file) be recommended for cases like this?
Yes a response file will solve this issue. The limit for command lines is much smaller under windows and that is why they were done in the first place to workaround the limitations there. > > I'm looking forward to hearing your thoughts. > > Reproduction Steps: (Applicable to all versions of gcc) > > 1) echo 'int main() { return 0; }' > test.c > 2) ARGS=$(perl -e 'print "-I/tmp " x 16384') > 3) gcc test.c $ARGS -o test > > gcc: fatal error: cannot execute ‘/usr/lib/gcc/x86_64-linux-gnu/11/cc1’: > execv: Argument list too long > compilation terminated. > > However, clang can able to produce output. Well clang is not exactly a driver and links directly against the front-ends so it does not need to call out to other programs*. *) The exception is the linker so you will run into issues there if you have a lot of files to link against. Thanks, Andrew Pinski > > Best Regards, > Geeta D