Skip to content

Should ghcWithPackages withLLVM default to true on platforms where ghc requires llvm? #116235

@Thra11

Description

@Thra11

Describe the bug
On aarch64-linux, if you try to build a haskell project in a nix-shell with ghcWithPackages, it will often fail because ghcWithPackages' withLLVM parameter defaults to false, but GHC on aarch64 requires the llvm executables opt and llc to compile things. There is no documentation mentioning the withLLVM parameter, and it's not clear whether it is possible for the user to override it.

To Reproduce
Steps to reproduce the behavior:

  1. Get the source code for a haskell project (As an example git clone https://github.com/nick8325/quickcheck && cd quickcheck)
  2. Spawn a shell with the necessary dependencies and try to build the project:
nix-shell --pure -p cabal-install "haskellPackages.ghcWithPackages (pkgs: with pkgs; [ splitmix random ])" --run "cabal build"

It will fail with something like

<no location info>: error:
    Warning: Couldn't figure out LLVM version!
             Make sure you have installed LLVM 9
ghc: could not execute: opt

If I change withLLVM to true in nixpkgs, it builds successfully.

Expected behavior
It should successfully build the project (or it should be documented / easy for the user to specify withLLVM = true themselves)

Notify maintainers
@maralorn @peti @Ericson2314 @abbradar @matthewbauer

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "aarch64-linux"
  • host os: Linux 5.10.0-rc5, NixOS, 21.05.git.9e76aa2cca8M (Okapi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.10
  • channels(root): "nixos-20.03.git.0c1c18c"
  • nixpkgs: /home/thrall/nixpkgs

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
    ghcWithPackages
# a list of nixos modules affected by the problem
module:

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: haskellGeneral-purpose, statically typed, purely functional programming language
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions