代码之家  ›  专栏  ›  技术社区  ›  George

NixOS上的Haskell堆栈错误:“包中缺少文件”

  •  0
  • George  · 技术社区  · 7 年前

    $ stack --nix build
    th-expand-syns-0.4.4.0: configure
    th-expand-syns-0.4.4.0: build
    bytes-0.15.3: configure
    bytes-0.15.3: build                                 
    th-lift-instances-0.1.11: configure                 
    th-lift-instances-0.1.11: build                     
    Progress 3/9                                        
    
    --  While building custom Setup.hs for package bytes-0.15.3 using:
          /run/user/1000/stack22517/bytes-0.15.3/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
        Process exited with code: ExitFailure 1
        Logs have been written to: /home/george/godot-haskell/.stack-work/logs/bytes-0.15.3.log
    
        [1 of 2] Compiling Main             ( /run/user/1000/stack22517/bytes-0.15.3/Setup.lhs, /run/user/1000/stack22517/bytes-0.15.3/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/setup/Main.o )
        [2 of 2] Compiling StackSetupShim   ( /home/george/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /run/user/1000/stack22517/bytes-0.15.3/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/setup/StackSetupShim.o )
        Linking /run/user/1000/stack22517/bytes-0.15.3/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/setup/setup ...
        Configuring bytes-0.15.3...
        Preprocessing library for bytes-0.15.3..
        Building library for bytes-0.15.3..
        [1 of 5] Compiling Data.Bytes.Get   ( src/Data/Bytes/Get.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/Data/Bytes/Get.o )
        [2 of 5] Compiling Data.Bytes.Put   ( src/Data/Bytes/Put.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/Data/Bytes/Put.o )
        [3 of 5] Compiling Data.Bytes.Signed ( src/Data/Bytes/Signed.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/Data/Bytes/Signed.o )
        [4 of 5] Compiling Data.Bytes.VarInt ( src/Data/Bytes/VarInt.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/Data/Bytes/VarInt.o )
        [5 of 5] Compiling Data.Bytes.Serial ( src/Data/Bytes/Serial.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/Data/Bytes/Serial.o )
        Failed to load interface for ‘Control.Monad.Primitive’
        There are files missing in the ‘primitive-0.6.3.0’ package,
        try running 'ghc-pkg check'.
        Use -v to see a list of the files searched for.
    
    
    --  While building custom Setup.hs for package th-lift-instances-0.1.11 using:
          /home/george/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
        Process exited with code: ExitFailure 1
        Logs have been written to: /home/george/godot-haskell/.stack-work/logs/th-lift-instances-0.1.11.log
    
        Configuring th-lift-instances-0.1.11...
        Preprocessing library for th-lift-instances-0.1.11..
        Building library for th-lift-instances-0.1.11..
        [1 of 1] Compiling Instances.TH.Lift ( src/Instances/TH/Lift.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/Instances/TH/Lift.o )
        Failed to load interface for ‘Control.Monad.Primitive’
        There are files missing in the ‘primitive-0.6.3.0’ package,
        try running 'ghc-pkg check'.
        Use -v to see a list of the files searched for.
    
    
    --  While building custom Setup.hs for package th-expand-syns-0.4.4.0 using:
          /home/george/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
        Process exited with code: ExitFailure 1
        Logs have been written to: /home/george/godot-haskell/.stack-work/logs/th-expand-syns-0.4.4.0.log
    
        Configuring th-expand-syns-0.4.4.0...
        Preprocessing library for th-expand-syns-0.4.4.0..
        Building library for th-expand-syns-0.4.4.0..
        [1 of 2] Compiling Language.Haskell.TH.ExpandSyns.SemigroupCompat ( Language/Haskell/TH/ExpandSyns/SemigroupCompat.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/Language/Haskell/TH/ExpandSyns/SemigroupCompat.o )
        [2 of 2] Compiling Language.Haskell.TH.ExpandSyns ( Language/Haskell/TH/ExpandSyns.hs, .stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/Language/Haskell/TH/ExpandSyns.o )
    
        /run/user/1000/stack22517/th-expand-syns-0.4.4.0/Language/Haskell/TH/ExpandSyns.hs:18:1: error:
            Could not find module ‘Data.Generics’
            There are files missing in the ‘syb-0.7’ package,
            try running 'ghc-pkg check'.
            Use -v to see a list of the files searched for.
           |
        18 | import Data.Generics
           | ^^^^^^^^^^^^^^^^^^^^
    

    ghc-pkg check -v 产生以下结果:

    $ ghc-pkg check -v
    GHC package manager version 8.2.2
    Timestamp 1970-01-01 00:00:01 UTC for /nix/store/3v8p0pvcplr3bfvrnh4fyqrqk2ddyl6f-ghc-8.2.2/lib/ghc-8.2.2/package.conf.d/package.cache
    using cache: /nix/store/3v8p0pvcplr3bfvrnh4fyqrqk2ddyl6f-ghc-8.2.2/lib/ghc-8.2.2/package.conf.d/package.cache
    db stack: ["/home/george/.ghc/x86_64-linux-8.2.2/package.conf.d","/nix/store/3v8p0pvcplr3bfvrnh4fyqrqk2ddyl6f-ghc-8.2.2/lib/ghc-8.2.2/package.conf.d"]
    flag db stack: ["/home/george/.ghc/x86_64-linux-8.2.2/package.conf.d","/nix/store/3v8p0pvcplr3bfvrnh4fyqrqk2ddyl6f-ghc-8.2.2/lib/ghc-8.2.2/package.conf.d"]
    

    $ ghc-pkg list
    /nix/store/3v8p0pvcplr3bfvrnh4fyqrqk2ddyl6f-ghc-8.2.2/lib/ghc-8.2.2/package.conf.d
        Cabal-2.0.1.0
        array-0.5.2.0
        base-4.10.1.0
        binary-0.8.5.1
        bytestring-0.10.8.2
        containers-0.5.10.2
        deepseq-1.4.3.0
        directory-1.3.0.2
        filepath-1.4.1.2
        ghc-8.2.2
        ghc-boot-8.2.2
        ghc-boot-th-8.2.2
        ghc-compact-0.1.0.0
        ghc-prim-0.5.1.1
        ghci-8.2.2
        haskeline-0.7.4.0
        hoopl-3.10.2.2
        hpc-0.6.0.3
        integer-gmp-1.0.1.0
        pretty-1.1.3.3
        process-1.6.1.0
        rts-1.0
        template-haskell-2.12.0.0
        terminfo-0.4.1.0
        time-1.8.0.2
        transformers-0.5.2.0
        unix-2.7.2.2
        xhtml-3000.2.2
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   Lucy Maya Menon    7 年前

    我认为这是Stack的问题,不是Nix的问题。虽然我很少在Nix上使用stack,但看起来 ~/.stack (或者 ./.stack-work ?) 目录已损坏,因为堆栈将其所有Haskell依赖项都保存在其中(独立于Nix,即使使用 --nix

    推荐文章