Skip to content

Haskell deps that use backpack get mangled #40128

@andrewthad

Description

@andrewthad

Issue description

I have a repository on github that illustrates this issue. Using nix to build a haskell project with a dependency that uses backpack internally does not work correctly.

Steps to reproduce

The steps to reproduce are provided in the repository linked above, but a copy is provided here:

Run the following commands, which results in the error shown afterwards:

bash> git clone https://github.com/andrewthad/nix-backpack-problem
bash> nix-build --pure release.nix
... elided for brevity ...
Preprocessing executable 'example' for nix-backpack-problem-1.0.0..
Building executable 'example' for nix-backpack-problem-1.0.0..
[1 of 1] Compiling Main             ( Main.hs, dist/build/example/example-tmp/Main.o )
/nix/store/ah79awgrjc75c68nn6gp32v4a9qli7mn-primitive-containers-0.1.0.0/lib/ghc-8.4.1/primitive-containers-0.1.0.0/Data/Map/Unboxed/Lifted.hi
Declaration for primitive-containers-0.1.0.0-Dh702QUZ6mrBrQ6cfYPU3V:Data.Map.Unboxed.Lifted.$fIsListMap2{v r8x}:
  Bad interface file: /nix/store/ah79awgrjc75c68nn6gp32v4a9qli7mn-primitive-containers-0.1.0.0/lib/ghc-8.4.1/primitive-containers-0.1.0.0/Map.hi
      Something is amiss; requested module  primitive-containers-0.1.0.0-JNYz44HuDdtIDtASnNcM9F-map-indef+2bbwYj3qpR1AhwaWbfmWe2:Map differs from name found in the interface file primitive-containers-0.1.0.0-JNYz44HuDdtIDtASnNcM9F-map-indef+K2XRbKjbYZpLEn7VFxOfUn:Map (if these names look the same, try again with -dppr-debug)

<no location info>: error:
    Cannot continue after interface file error
builder for '/nix/store/0bkrbljm2kyph09waf7lw9ksmqfkrckf-nix-backpack-problem-1.0.0.drv' failed with exit code 1
error: build of '/nix/store/0bkrbljm2kyph09waf7lw9ksmqfkrckf-nix-backpack-problem-1.0.0.drv' failed

Make sure you do not have a dist or dist-newstyle directory in here since
that confuses nix-build and can make it claim that it has successfully built
the project. I am able to successfully build this project, and projects like it,
with cabal new-build when I am not using nix. I suspect that the problem is
that the different instantiations of the same indefinite module are somehow
clobbering one another.

cc @chessai @taktoa

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancementAdd something new2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: haskellGeneral-purpose, statically typed, purely functional programming language

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions