21

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?

Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
  • 5
    My understanding is that `ghc` just uses whatever `llc` executable is in path; http://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 Aug 13 '12 at 16:32
  • @applicative I have tried it with `PATH` but ended up having to file a bug report: http://hackage.haskell.org/trac/ghc/ticket/7143. – Cetin Sert Aug 14 '12 at 03:59
  • 1
    Did you get some resolution? I have the same issue using the GHC package under Arch Linux on ARM. – user2023370 Jun 23 '13 at 00:39
  • 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 Jun 23 '13 at 01:11

2 Answers2

6

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.

Reid Barton
  • 14,951
  • 3
  • 39
  • 49
1

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.

mcandre
  • 22,868
  • 20
  • 88
  • 147