- rGHC Glasgow Haskell Compiler
No Unit Test Coverage
- Build Status
Buildable 20131 Build 43525: [GHC] Linux/amd64: Continuous Integration Build 43524: [GHC] OSX/amd64: Continuous Integration Build 43523: [GHC] Windows/amd64: Continuous Integration Build 43522: arc lint + arc unit
I don't really understand this fix, under what circumstances would GCC return a file that doesn't exist?
The whole point of --print-file-name is to print what would be used for linking. The driver code in GCC already attempt to open the file for reading and would only then return it if the file exists and has the right permissions (so it's a stronger check than what is being done here).
It would a bit pointless for it to return something the linker couldn't use as that would just error out.
So I'm trying to understand how GCC can find a file for reading yet ghci cant?
Let me indulge you in some fun :-)
Setting the stage:
$ tree . └── gmp 1 directory, 0 files
And torturing gcc
$ gcc -B$PWD --print-file-name gmp /Users/angerman/tmpl/gmp
But... the question we all have been asking:
$ gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.0.0 (clang-900.0.39.2) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
It's gcc in disguise! ;-) But is it clang that's at fault here?
I've only got a cross gcc at hand:
$ /nix/store/casycyxaf99445k2xmkpi3xcn2k5rfvb-gcc-7.3.0-x86_64-pc-mingw32-stage-static/bin/x86_64-pc-mingw32-gcc --version x86_64-pc-mingw32-gcc (GCC) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Let's see what it will report...
$ /nix/store/casycyxaf99445k2xmkpi3xcn2k5rfvb-gcc-7.3.0-x86_64-pc-mingw32-stage-static/bin/x86_64-pc-mingw32-gcc -B$PWD --print-file-name gmp /Users/angerman/tmpl/gmp
😱 Oh no!
Note: this is all on macOS.
Right, the problem is that gcc is referring to the posix definition of a file. Where directories are just special files. And the driver later filters them out.
So only on platforms that are posix complaint will directories be returned.
It sucks having to make askGCC even more expensive, but luckily it's only used as a last resort nowadays.