-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot Compile EXE on Shared Network Drive #112
Comments
It looks like UNC paths don't work. I have seen similar issues with GDB too. If you map a network drive and use the drive letter instead, does it work then? How van your working directory be an UNC path? Windows doesn't allow this. Have you reported this issue to the GCC team (see https://gcc.gnu.org/bugs/)? |
Unfortunately, no, mapping to a drive letter does not work: My working directory can be a UNC path in PowerShell. See here: I am not sure if this is relevant, but I have a much older version of MinGW from Winbuilds (I installed from
I have not reported to the GCC team, but I will soon. |
They said it's a bug on the MinGW side of things: |
I can reproduce your issue with GCC 12.2.0. This works with GCC 12.1.0:
Same thing fazls with GCC 12.2.0:
With
And it's true: binutils is a newer version, so the issue may be in there. |
I think I found it. Through patches in the context of https://sourceware.org/bugzilla/show_bug.cgi?id=25713 changes were made to the function However, according to https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry the So additional code is needed to fix As a proof of concept I added this before #elif defined (__MINGW32__xxx)
FILE * file = fopen (filename, modes);
return close_on_exec (file); and that fixed the problem for me (but obviously will have the maximum path length limit again). |
I just made a new release with the above change to binutils. Can you confirm that release works for you with UNC paths? |
Bug reported at binutils: https://sourceware.org/bugzilla/show_bug.cgi?id=29533 |
I tried the following with the latest release and got no issues: echo "int main () { return 0; }" > '\\servername\share\hello.cpp'
g++ -std=c++17 '\\servername\share\hello.cpp' -o '\\servername\share\hello.exe'
'\\servername\share\hello.exe' |
If I compile with:
g++ -std=c++17 iterate.cpp -o "\\machine_name\d\performance testing\out.exe"
I get this output and no .exe file:
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file \\machine_name\d\performance testing\out.exe: Invalid argument collect2.exe: error: ld returned 1 exit status
If I change the output path to a system drive rather than one on the network, it compiles fine. It gives the same error if I use a local, rather than absolute, path as well (and have the working directory on the network drive).
The text was updated successfully, but these errors were encountered: