llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.05k stars 11.98k forks source link

lld-link.exe fails to build on a Windows networked drive running under Parallels VM / LLVM ERROR: IO failure on output stream: bad file descriptor #41968

Open llvmbot opened 5 years ago

llvmbot commented 5 years ago
Bugzilla Link 42623
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @jh7370,@rnk,@sbc100

Extended Description

I have a program that builds with no errors or warnings on a Windows-10 system internal drive (C:) that runs in a Parallels VM on OSX.

The same program won't build if the project files are on a Parallels shared drive, which is mapped into Windows as a network drive.

The error is: LLVM ERROR: IO failure on output stream: bad file descriptor

There seems to be a related problem from the Rust community: https://github.com/rust-lang/rust/issues/54216

sbc100 commented 3 years ago

We have emscripten users reporting the similar issues with wasm-ld that I suspect is related to VM usage:

https://github.com/emscripten-core/emsdk/issues/686 https://github.com/emscripten-core/emsdk/issues/677

llvmbot commented 5 years ago

One more note: Using MSVC or the Intel C++ compiler instead of LLVM, everything works.

llvmbot commented 5 years ago

Sorry for the late answer.

I don't think I'm using anything special. Here is the linker command line:

'C:\Program Files (x86)\LLVM\bin\lld-link.exe' /dll /def:dll.def /libpath:../../../libs /libpath:'C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\compiler\lib\ia32' /libpath:'C:\Program Files (x86)\LLVM\lib\clang\8.0.0\lib\windows' /nodefaultlib:libcmt.lib /nodefaultlib:libcpmt.lib /out:c:\tmp\video-player.dll ../src/main.o ../src/player.o kernel32.lib user32.lib gdi32.lib ole32.lib msvcrt.lib mf.lib mfplat.lib mfuuid.lib strmiids.lib

But I'm going to link Parallels Support to this ticket. Maybe that helps them too.

rnk commented 5 years ago

I believe this error often arises when the file descriptor limit is reached. It's plausible that network drives have lower descriptor limits.

LLD's current normal file I/O pattern looks like this:

However, the text of the error message comes from raw_fd_ostream, which is not used for normal output writing in LLD. Are you using LTO or some other feature? LLD seems to only use output streams for auxiliary files like XML manifests and LTO blobs.