The parameters passed to the compiler are too long, causing compilation errors

Hello everyone, I am trying to customize a platform for MG24. I encountered a problem during compilation: Since MG24 needs to contain many paths, the final path parameter passed to the compiler is too long (50,000 characters). I compiled it on W10, and an error occurred, causing the compilation to fail. I would like to ask if there is any way (such as passing a relative path to the compiler) to solve this problem?

Usually PlatformIO tries to detect if the invocation command for a compiler is too long and tries the command arguments to a file instead, letting the compiler read the options from the (unlimited length) file instead of from the limited length command string itself.

I have seen that not working properly in some edge cases though, mainly for Espressif32 with a custom Arduino framework. If this issue is reproducable, please file a bug report in https://github.com/platformio/platformio-core/issues so that this can finally be solved.

There is also a workaround to minimize the command string length: For include paths, you can write all the -I <path> flags (e.g. core/arduino) to a file, and then tell GCC to load the arguments from that file plus some prefix (which is usually the path to the package folder folder itself (e.g., C:\Users\<user>\.platformio\packages\framework-xxxx), with -iprefix <prefix path> @<file path>.

This technique is e.g. used in the official ArduinoCore-mbed core.

https://github.com/arduino/ArduinoCore-mbed/blob/main/variants/RASPBERRY_PI_PICO/includes.txt

Thank you very much, this method can successfully solve this problem