The actual workaround is to set the working directory as in this Python example: result = subprocess.run(gcc_arguments, cwd=mingw_bin_dirname, capture_output=True) where cwd is set.
compilation fails with unset PATH