我遵循了在http://lethalman.blogspot.com/2014/08/nix-pill-8-generic-builders.html上构建GNU的步骤,下面是我用来构建GNUHello2.9的文件:
$ wget -c http://ftp.gnu.org/gnu/hello/hello-2.9.tar.gzhello.nix:
$ cat hello.nix
let
pkgs = import <nixpkgs> {};
mkDerivation = import ./autotools.nix pkgs;
in mkDerivation {
name = "hello";
src = ./hello-2.9.tar.gz;
}autotools.nix:
$ cat autotools.nix
pkgs: attrs:
with pkgs;
let defaultAttrs = {
builder = "${bash}/bin/bash";
args = [ ./builder.sh ];
baseInputs = [ gnutar gzip gnumake gcc binutils coreutils gawk gnused gnugrep ];
buildInputs = [];
system = builtins.currentSystem;
};
in
derivation (defaultAttrs // attrs)builder.sh:
$ cat builder.sh
set -e
unset PATH
for p in $buildInputs; do
export PATH=$p/bin${PATH:+:}$PATH
done
tar -xf $src
for d in *; do
if [ -d "$d" ]; then
cd "$d"
break
fi
done
./configure --prefix=$out
make
make install错误信息:
$ nix-build hello.nix
these derivations will be built:
/nix/store/d84l57agx3rmw00lxs8gjlw8srmx1bh9-hello.drv
building '/nix/store/d84l57agx3rmw00lxs8gjlw8srmx1bh9-hello.drv'...
/nix/store/vv3xqdggviqqbvym25jf2pwv575y9j1r-builder.sh: line 7: tar: No such file or directory
builder for '/nix/store/d84l57agx3rmw00lxs8gjlw8srmx1bh9-hello.drv' failed with exit code 127
error: build of '/nix/store/d84l57agx3rmw00lxs8gjlw8srmx1bh9-hello.drv' failed在gnutar中似乎有autotools.nix,但是构建者仍然抱怨tar: No such file or directory,为什么会这样?
发布于 2018-11-15 20:14:49
问题可能是gnutar在baseInputs列表中,而您正在构建路径的buildInputs列表完全是空的,因此您的路径上什么都不会出现。尝试更改shell脚本中的for行,以便使用两个列表的连接构建路径:
for p in $baseInputs $buildInputs; do您可以将echo $PATH添加到构建器脚本中,以调试类似的问题。
这就是博文作者在这篇文章中要求你做的事情:
通过在for循环中添加builder.sh和$buildInputs来完成新的$buildInputs。
https://stackoverflow.com/questions/53313902
复制相似问题