Created attachment 44229 [details] output of compilation with compiler in directories with different length If the compiler file structure is placed in a folder with a name that is 163 characters or longer, the GCC will fail to include certain files and/or run sub-programs (cc1.exe etc). Tested on Windows 7, and Windows 10, with GCC based on 6.3.1. How to reproduce: Create a simple file c:\test.c: #include <stdio.h> int main() { return 0; } Place a Windows native GCC toolchain in a folder called c:\1 which includes the bin, lib, share and target folders directly in it. Use cygwin or other environment to run help script to try with different folder name lengths: cd /cygdrive/c str="" for i in `seq 1 256`; do echo "Testing length $i"; str="1$str"; mv 1* $str; 1*/bin/arm-none-eabi-gcc test.c -o test.o --specs=nano.specs -specs=nosys.specs; done Adjust above script as necessary for your environment, but you should get similar results to the attached output. In the attached output we can see that when the folder name is 163 characters or longer, we see the first type of error, GCC can no longer find all the header files in the compiler structure. At folder length 180, GCC can no longer find stdio.h. At folder length 214, GCC no longer can CreateProcess cc1.exe. After that length specs files can not be found.
Windows has a 260 character default maximum path length. See for instance https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath This looks like an OS problem not a gcc problem.
(In reply to Jim Wilson from comment #1) > Windows has a 260 character default maximum path length. See for instance > https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85). > aspx#maxpath > > This looks like an OS problem not a gcc problem. Maybe both. It is possible to read/write files that have longer paths than 260 characters if you use UNC paths by prefixing absolute paths with "\\?\" on Windows. For executing files on Windows we can improve the situation by using a combination of UNC paths together with GetShortPathNameW before sending the path to CreateProcessW. Only restriction here is that the resulting shorted path must still be shorter than 260 characters.