堆栈生成错误:缺少属性"ghc822",位于(string):1:53 [英] stack build error: attribute ‘ghc822’ missing, at (string):1:53

查看:78
本文介绍了堆栈生成错误:缺少属性"ghc822",位于(string):1:53的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在NixOS上构建haskell项目.

运行 $堆栈构建会出现以下错误.

  $堆栈构建错误:缺少属性"ghc822",位于(string):1:53(使用"--show-trace"显示详细的位置信息) 

此错误是什么意思,我该如何进行?当我按照建议运行 $ stack build --show-trace 时,得到以下输出,我也不明白.

  $堆栈构建--show-trace无效的选项`--show-trace'用法:堆栈构建[TARGET] [--dry-run] [--pedantic] [--fast][--ghc-options选项] [-标志包:[-]标志]([[--dependencies-only] | [--only-snapshot] |[--only-dependencies])([--file-watch] | [--file-watch-poll])[--exec CMD [ARGS]] [--only-configure] [--trace] [--profile][--no-strip] [-[no-] library-profiling][-[no]可执行文件分析] [-[no]库剥离][-[no-] executable-stripping] [-[no-] haddock][-黑线参数HADDOCK_ARGS] [-[无]打开][-[no] haddock-deps] [-[no-] haddock-internal][-[no-] haddock-hyperlink-source] [-[no-] copy-bins][-[no-] copy-compiler-tool] [-[no-] prefetch][-[无]继续前进] [-[无]力脏] [-[无]测试][-[no-] rerun-tests] [--ta | --test-arguments TEST_ARGS][--coverage] [--no-run-tests] [-[no-] bench][--ba |-基准参数BENCH_ARGS] [--no-run-benchmarks][-[no-] reconfigure] [-[no-] cabal-verbose][-[no-] split-objs] [--skip ARG] [--help]在此目录/配置中构建软件包 


我尝试将频道更改为 nixos-17.09 而不是 nixos-unstable (并运行 nix-channel --update ),但是仍然出现相同的错误.

$ code nix-channel --list 的输出如下所示.

  $ nix-channel --list堆叠https://nixos.org/channels/nixos-17.09nixos https://nixos.org/channels/nixos-17.09 


$ nix-env -qaPA'nixos.haskell.compiler'的输出显示已找到ghc822.

  $ nix-env -qaPA'nixos.haskell.compiler'警告:输入Nix表达式中的名称冲突,跳过"/home/matthew/.nix-defexpr/channels_root/nixos"nixos.haskell.compiler.ghc6102二进制ghc-6.10.2-binarynixos.haskell.compiler.ghc704 ghc-7.0.4nixos.haskell.compiler.ghc704Binary ghc-7.0.4-binarynixos.haskell.compiler.ghc7102 ghc-7.10.2nixos.haskell.compiler.integer-simple.ghc7102 ghc-7.10.2nixos.haskell.compiler.ghc7103 ghc-7.10.3nixos.haskell.compiler.integer-simple.ghc7103 ghc-7.10.3nixos.haskell.compiler.integer-simple.ghc742 ghc-7.4.2nixos.haskell.compiler.ghc742 ghc-7.4.2nixos.haskell.compiler.ghc742二进制ghc-7.4.2-binarynixos.haskell.compiler.ghc763 ghc-7.6.3nixos.haskell.compiler.ghc783 ghc-7.8.3nixos.haskell.compiler.integer-simple.ghc783 ghc-7.8.3nixos.haskell.compiler.ghc784 ghc-7.8.4nixos.haskell.compiler.integer-simple.ghc784 ghc-7.8.4nixos.haskell.compiler.ghc801 ghc-8.0.1nixos.haskell.compiler.integer-simple.ghc801 ghc-8.0.1nixos.haskell.compiler.ghc802 ghc-8.0.2nixos.haskell.compiler.integer-simple.ghc802 ghc-8.0.2nixos.haskell.compiler.integer-simple.ghc821 ghc-8.2.1nixos.haskell.compiler.ghc821 ghc-8.2.1nixos.haskell.compiler.integer-simple.ghc822 ghc-8.2.2nixos.haskell.compiler.ghc822 ghc-8.2.2nixos.haskell.compiler.integer-simple.ghcHEAD ghc-8.3.20170808nixos.haskell.compiler.ghcHEAD ghc-8.3.20170808nixos.haskell.compiler.ghcjs ghcjs-0.2.0nixos.haskell.compiler.ghcjsHEAD ghcjs-0.2.020170323nixos.haskell.compiler.jhc jhc-0.8.2nixos.haskell.compiler.uhc uhc-1.1.9.4 

我通过 $ nix-env -iA nixos.haskell.compiler.ghc822 $ ghc --version 安装了 ghc8.2.2 现在返回

  $ ghc --versionGlorious Glasgow Haskell编译系统,版本8.2.2 

但是,在尝试运行 $ stack build 时,仍然出现错误 error:属性'ghc822',位于(string):1:54 .>

此外,我试图查看安装后我的 stack 正在使用的 ghc 版本,这导致缺少相同的属性'ghc822'错误.

  $ stack ghc---version错误:缺少属性"ghc822",位于(string):1:54(使用"--show-trace"显示详细的位置信息) 

解决方案

正如palik所言,更改了解析器版本-在我的情况下是更改

解析器:lts-11.3

解析器:lts-9.1

stack.yaml 中的

是一种解决方法.我不知道更深层的问题是什么,但是有兴趣知道.

I am attempting to build my haskell project on NixOS.

Running $ stack build gives the following error.

$ stack build
error: attribute ‘ghc822’ missing, at (string):1:53
(use ‘--show-trace’ to show detailed location information)

What does this error mean and how could I proceed? When I run $ stack build --show-trace as suggested, I get the following output, which I do not understand either.

$ stack build --show-trace
Invalid option `--show-trace'

Usage: stack build [TARGET] [--dry-run] [--pedantic] [--fast]
                   [--ghc-options OPTIONS] [--flag PACKAGE:[-]FLAG]
                   ([--dependencies-only] | [--only-snapshot] |
                   [--only-dependencies]) ([--file-watch] | [--file-watch-poll])
                   [--exec CMD [ARGS]] [--only-configure] [--trace] [--profile]
                   [--no-strip] [--[no-]library-profiling]
                   [--[no-]executable-profiling] [--[no-]library-stripping]
                   [--[no-]executable-stripping] [--[no-]haddock]
                   [--haddock-arguments HADDOCK_ARGS] [--[no-]open]
                   [--[no-]haddock-deps] [--[no-]haddock-internal]
                   [--[no-]haddock-hyperlink-source] [--[no-]copy-bins]
                   [--[no-]copy-compiler-tool] [--[no-]prefetch]
                   [--[no-]keep-going] [--[no-]force-dirty] [--[no-]test]
                   [--[no-]rerun-tests] [--ta|--test-arguments TEST_ARGS]
                   [--coverage] [--no-run-tests] [--[no-]bench]
                   [--ba|--benchmark-arguments BENCH_ARGS] [--no-run-benchmarks]
                   [--[no-]reconfigure] [--[no-]cabal-verbose]
                   [--[no-]split-objs] [--skip ARG] [--help]
  Build the package(s) in this directory/configuration


I tried changing my channel to nixos-17.09 instead of nixos-unstable (and running nix-channel --update), but still get the same error.

Output of $ nix-channel --list is shown below.

$ nix-channel --list
stack https://nixos.org/channels/nixos-17.09
nixos https://nixos.org/channels/nixos-17.09


The output of $ nix-env -qaPA 'nixos.haskell.compiler' shows ghc822 to be found.

$ nix-env -qaPA 'nixos.haskell.compiler'
warning: name collision in input Nix expressions, skipping ‘/home/matthew/.nix-defexpr/channels_root/nixos’
nixos.haskell.compiler.ghc6102Binary           ghc-6.10.2-binary
nixos.haskell.compiler.ghc704                  ghc-7.0.4
nixos.haskell.compiler.ghc704Binary            ghc-7.0.4-binary
nixos.haskell.compiler.ghc7102                 ghc-7.10.2
nixos.haskell.compiler.integer-simple.ghc7102  ghc-7.10.2
nixos.haskell.compiler.ghc7103                 ghc-7.10.3
nixos.haskell.compiler.integer-simple.ghc7103  ghc-7.10.3
nixos.haskell.compiler.integer-simple.ghc742   ghc-7.4.2
nixos.haskell.compiler.ghc742                  ghc-7.4.2
nixos.haskell.compiler.ghc742Binary            ghc-7.4.2-binary
nixos.haskell.compiler.ghc763                  ghc-7.6.3
nixos.haskell.compiler.ghc783                  ghc-7.8.3
nixos.haskell.compiler.integer-simple.ghc783   ghc-7.8.3
nixos.haskell.compiler.ghc784                  ghc-7.8.4
nixos.haskell.compiler.integer-simple.ghc784   ghc-7.8.4
nixos.haskell.compiler.ghc801                  ghc-8.0.1
nixos.haskell.compiler.integer-simple.ghc801   ghc-8.0.1
nixos.haskell.compiler.ghc802                  ghc-8.0.2
nixos.haskell.compiler.integer-simple.ghc802   ghc-8.0.2
nixos.haskell.compiler.integer-simple.ghc821   ghc-8.2.1
nixos.haskell.compiler.ghc821                  ghc-8.2.1
nixos.haskell.compiler.integer-simple.ghc822   ghc-8.2.2
nixos.haskell.compiler.ghc822                  ghc-8.2.2
nixos.haskell.compiler.integer-simple.ghcHEAD  ghc-8.3.20170808
nixos.haskell.compiler.ghcHEAD                 ghc-8.3.20170808
nixos.haskell.compiler.ghcjs                   ghcjs-0.2.0
nixos.haskell.compiler.ghcjsHEAD               ghcjs-0.2.020170323
nixos.haskell.compiler.jhc                     jhc-0.8.2
nixos.haskell.compiler.uhc                     uhc-1.1.9.4

I installed ghc8.2.2 via $ nix-env -iA nixos.haskell.compiler.ghc822, and $ ghc --version now returns

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.2.2

However, I still get the error error: attribute ‘ghc822’ missing, at (string):1:54 when attempting to run $ stack build.

Also, I attempted to see what ghc version my stack is using after this install, and this led to the same attribute ‘ghc822’ missing error.

$ stack ghc -- --version
error: attribute ‘ghc822’ missing, at (string):1:54
(use ‘--show-trace’ to show detailed location information)

解决方案

As palik commented, changing the resolver version -- in my case changing

resolver: lts-11.3

to

resolver: lts-9.1

in stack.yaml is a work-around. I do not know what the deeper issue is but would be interested to know.

这篇关于堆栈生成错误:缺少属性"ghc822",位于(string):1:53的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆