gpt4 book ai didi

nixos - 如何在nix-shell中选择GCC版本?

转载 作者:行者123 更新时间:2023-12-03 19:45:22 28 4
gpt4 key购买 nike

我要求的是GCC 8,但我却得到了GCC 7。

$ nix-shell -p gcc8
[nix-shell:~]$ gcc --version
gcc (GCC) 7.3.0

到底是怎么回事?

最佳答案

您需要将环境基于stdenvNoCC而不是stdenv
这意味着,您可以在当前目录中创建shell.nixdefault.nix文件,定义环境,然后运行nix-shell

with import <nixpkgs> {}; {
qpidEnv = stdenvNoCC.mkDerivation {
name = "my-gcc8-environment";
buildInputs = [
gcc8
go
ruby_2_4
gdb
swig
# libev
#...
];
};
}

现在,它可以按预期工作
$ nix-shell
[nix-shell:~]$ gcc --version
gcc (GCC) 8.1.0

资料来源: https://groups.google.com/forum/#!topic/nix-devel/of6P-sEtQN0

关于nixos - 如何在nix-shell中选择GCC版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50277775/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com