snowleopard / hadrian

Hadrian: a new build system for the Glasgow Haskell Compiler. Now merged into the GHC tree!
https://gitlab.haskell.org/ghc/ghc/tree/master/hadrian
MIT License
208 stars 39 forks source link

Custom build root does not work on Windows #666

Open snowleopard opened 5 years ago

snowleopard commented 5 years ago

I've tried changing the build root on Windows like this:

$ ./build.stack.bat -j --flavour=quickest --integer-simple -c -o/d/test

and this:

$ ./build.stack.bat -j --flavour=quickest --integer-simple -c -oD:\test

But both fail with errors:

C:/msys/home/nam83/ghc/D:/test/stage0/utils/compare_sizes\: openBinaryTempFileWithDefaultPermissions: invalid argument (Invalid argument)

and

cp: cannot create directory ‘D:test/mingw’: No such file or directory

Clearly we are not handling paths correctly. I suspect we oversimplified our implementation of -/-:

https://github.com/snowleopard/hadrian/blob/master/src/Hadrian/Utilities.hs#L133-L140

There is already an issue about -/-: #434, but I'm not sure if it's necessarily a duplicate.

alpmestan commented 5 years ago

Hmm. Isn't there an implementation of this somewhere, that we could just use or steal?

snowleopard commented 5 years ago

@alpmestan Presumable </> does the right thing and we used to have a -/- b = unifyPath (a </> b) but that was very slow due to unifyPath, which we need, as otherwise Windows paths are a mess of slashes looking in random directions. We should clearly be able to do better, but noone has yet come up with a good plan.