Open ezyang opened 7 years ago
keep-tmp-files
I thought we had it: https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/Utils.hs#L1333 Is it broken?
Doesn't do you much good if you don't plumb it where necessary ;)
withTempFile :: FilePath -- ^ Temp dir to create the file in
-> String -- ^ File name template. See 'openTempFile'.
-> (FilePath -> Handle -> IO a) -> IO a
withTempFile tmpDir template action =
withTempFileEx defaultTempFileOptions tmpDir template action
That's a backwards compat shim for Custom setups. I suppose we could deprecate it.
Is this task still a thing? If so I can try to tackle it @ezyang
It probably is. Try running Cabal with a completely broken compiler setup and it should probably repro.
@angerman was reporting on IRC that Cabal couldn't find
iconv
, but everything seemed like it was in order. When he posted-v3
logs, the true error came to light:The failure of
clang
had nothing to do with linkingiconv
: rather, it was failing because ofclang: error: invalid linker name in argument '-fuse-ld=gold'
.The way to solve this problem is, before we test if any of the libraries fail the linker, FIRST check if we can build a vanilla C file at all. If we can't, that means that there's something wrong with the options: output the error message verbatim.
There's a few other lessons too:
Even after the failure, Cabal goes off and tries to compile the headers. This caused me to take more time to diagnose the problem, because the true "failure" was further up the scrollback. We should error more quickly.
The error message should suggest running at higher verbosity to see the error message the compiler output, or just unconditionally report the actual error that caused the problem. None of this cloak and dagger "I ran something but I'm not going to tell you what I did, neener-neener."
Also, can we finally get
keep-tmp-files
for Cabal? This thing where the temporary files disappear before I can look at them is really annoying.