https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97574
Bug ID: 97574 Summary: Allow for nul output with Windows Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: svnpenn at gmail dot com Target Milestone: --- Allow for nul output with Windows A project I am trying to compile has this command: cc -xc++ -o/dev/null -lc++ -shared However I am using PowerShell, which has no notion of `/dev/null`: PS C:\> cc -xc++ -o/dev/null -lc++ -shared C:/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../ x86_64-w64-mingw32/bin/ld.exe: cannot open output file /dev/null.exe: No such file or directory I tried using `-o$null`, but it just creates a file `$null.exe`. I also tried this: PS C:\> cc -xc++ -o $null -lc++ -shared cc.exe: fatal error: no input files It appears the issue is specific to GCC. If I get Clang [1], the same command works with `nul` [2]: cc -xc++ -onul -lc++ -shared but if I try the same thing with GCC, I get this: C:/msys2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../ x86_64-w64-mingw32/bin/ld.exe: nul.exe: final close failed: file truncated Alternatively, if anyone knows a better way to check the availability of a library, I would be interested in that. [1] https://github.com/mstorsjo/llvm-mingw [2] https://support.microsoft.com/help/110930