https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101238
Bug ID: 101238 Summary: Driver won't find cc1/cc1plus on MinGW, CXXFLAGS need -D__USE_MINGW_ACCESS Product: gcc Version: 10.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: tomas.kalibera at gmail dot com Target Milestone: --- Created attachment 51070 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51070&action=edit Use -D__USE_MINGW_ACCESS when compiling the driver. Summary: one needs to add CXXFLAGS+=-D__USE_MINGW_ACCESS to config/mh-mingw so that the driver finds executables on Windows. This is already fixed in GCC 11, but not in GCC 10. More details: GCC 10 driver is compiled with g++ without-D__USE_MINGW_ACCESS on MinGW. That option is only added to CFLAGS, but not CXXFLAGS. Consequently, the driver will not find executables such as cc1, because access(,X_OK) will always return an error on Windows, as access() on Windows does not check for executability anymore. With __USE_MINGW_ACCESS, MinGW will use its own implementation of access() which for X_OK behaves the same as R_OK. I've tested the (trivial) attached patch and it resolved the issue on my system as expected.