20
votes

I have successfully built PortFusion with the brand new 64-bit GHC 7.6.1 Release Candidate 1 for Windows.

Using freshly downloaded native 64-bit mingw binaries from http://www.drangon.org/mingw, the network package was as easy to install (after a bunch of non-relevant small fixes) as a simple

CC=mingw64/bin/gcc cabal install

There is also an LLVM toolchain package on the same website.

Now I wonder how I could tell GHC to use specific LLVM binaries during compilation.


Would it be something as simple and similar to above as:

#v??v
 LLVM=????????? ghc -W -O2 -fllvm -optlo-O3 --make src/Main.hs
 LLVM=????????? cabal install PortFusion -f llvm #¹
#^??^

¹ relevant line in PortFusion.cabal defining the llvm flag

or completely different?

2
My understanding is that ghc just uses whatever llc executable is in path; hackage.haskell.org/trac/ghc/wiki/Building/Preparation/Windows suggests that you would follow the standard unixy instruction of adding export PATH=${PATH}:/c/dev/llvm/bin to a .profile file, assuming thats where llc ended up.applicative
@applicative I have tried it with PATH but ended up having to file a bug report: hackage.haskell.org/trac/ghc/ticket/7143.Cetin Sert
Did you get some resolution? I have the same issue using the GHC package under Arch Linux on ARM.user2023370
No, I have not. I would have written an answer otherwise. Please let us know of how things go for you on Linux!Cetin Sert

2 Answers

5
votes

For the record, the answer to the question in the title is

ghc -pgmlo opt_cmd -pgmlc llc_cmd -fllvm ...

opt_cmd and llc_cmd can be either command names (that will be looked up in PATH) or full pathnames.

1
votes

You may be able to get GHC to use certain binaries by altering where they are defined in the PATH environment variable. Earlier takes precedence. Presumably, System PATH is also higher precedence than User PATH.