haskell.nix icon indicating copy to clipboard operation
haskell.nix copied to clipboard

-fllvm and llvm?

Open o1lo01ol1o opened this issue 5 years ago • 4 comments

What's the recommended way to respect the -fllvm flag in a cabal file and, at the same time, get a correct version of LLVM included as a dep when using stack-to-nix or cabal-to-nix?

o1lo01ol1o avatar Oct 10 '19 03:10 o1lo01ol1o

@o1lo01ol1o I'm afraid I don't understand the first part of your question:

What's the recommended way to respect the -fllvm flag in a cabal file for correct version of LLVM included as a dep when using stack-to-nix or cabal-to-nix? luckily most recent ghc's (while warn) will compile with a relatively wide variety of recent LLVMs. The primary issue was that LLVM changed it's textual IR representation and GHC needed to stay in lockstep with the respective LLVM version to ensure that LLVm could parse the IR ghc would produce.

In general though the dependency is

stack -> (via stack-to-nix) -> lts -> ghc version -> nixpkgs provides ghc+llvm

and similarly for cabal projects.


Note that with the overlay branch that should arrive soon, haskell.nix will provide ghc's and we won't rely on the ones provided by nixpkgs anymore.

angerman avatar Oct 15 '19 06:10 angerman

@angerman My question was poorly specified after a long night of brute-forcing potential nix expressions. Let me see if I can rephrase.

Two potential cases:

  1. One has a bunch of components that need to build with the -fllvm flag in cabal. For this case, we only care that the LLVM provided "work" with the ghc. As you've said, this tends to be the majority of recent LLVMs. In this case, where does one plug pkgs.llvm in the expressions generated by stack-to-nix or cabal-to-nix to make llvm available? In my test project I haven't been able to figure this out, but I'm probably just missing something simple.

  2. In the event there's a specified version of llvm somewhere in the expressions generated by stack-to-nix or cabal-to-nix and some downstream project needs a specific llvm (say, accelerate and LLVM 7.0) how can upstream llvm be overridden?

o1lo01ol1o avatar Oct 15 '19 15:10 o1lo01ol1o

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 28 '22 23:09 stale[bot]

The LLVM use still depends on which GHC version, but it now comes from haskell.nix. For instance here is where it is set up for GHC 9.2.4 https://github.com/input-output-hk/haskell.nix/blob/7462e537efccfc4471908a5c96c5c72b2646f985/overlays/bootstrap.nix#L661-L663

hamishmack avatar Sep 30 '22 09:09 hamishmack