gpt4 book ai didi

rust - nixos:我的自定义包派生在 `cargo build` 上失败

转载 作者:行者123 更新时间:2023-11-29 08:17:55 24 4
gpt4 key购买 nike

我正在编写一个包派生来安装 kryptco/kr它在 cargo build 阶段失败。

kryptco/kr 有一个由 rust 编写的子模块 kryptco/sigchain。在Makefilekryptco/sigchain 中,他们使用 cargo web deploy 命令构建其子模块。我的包派生在此 cargo web deploy 阶段失败。

给出了这两个错误。

error: warning: replace for the non root package will be ignored, specify replace at the workspace root:
package: /build/src/github.com/kryptco/kr/sigchain/sigchain_client/Cargo.toml
workspace: /build/src/github.com/kryptco/kr/sigchain/Cargo.toml
error: failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
[6] Couldn't resolve host name; class=Net (12)

前一个错误提示要编辑 Cargo.toml 并添加 [replace] 部分,但我想尽可能避免编辑源代码。

这些错误的原因是什么?

这是我的包推导:

# Original: https://github.com/bogsen/nixos-public/blob/a0dc497eab5de528ce3006d\
36c52bc601422cf87/pkgs/krypton/default.nix

{ config, lib, pkgs, ... }: with lib; let
cfg = config.services.krypton;

cargoWeb = with pkgs; rustPlatform.buildRustPackage rec {
...
};
dependencies = with pkgs; [
cargo
emscripten
go
makeWrapper
perl
];

kr = pkgs.stdenv.mkDerivation {
name = "kr";

src = pkgs.fetchFromGitHub {
owner = "kryptco";
repo = "kr";
rev = "2.4.10";
sha256 = "1xxhlkcw2d52q1y4h40iyvq25804w7hzv0lflqnib68aps491xnj";
fetchSubmodules = true;
};

buildInputs = dependencies ++ [cargoWeb];

dontBuild = true;

postUnpack = ''
# prevent referring /homeless-shelter
export HOME=$(pwd)

# https://github.com/kryptco/kr/issues/254#issuecomment-464890476
sed -i.bak -e '8,11d' source/sigchain/Cargo.toml

export GOPATH=$(pwd)
export GOCACHE=$GOPATH/.cache/go-build
mkdir -p src/github.com/kryptco
mv source src/github.com/kryptco/kr
ln -s src/github.com/kryptco/kr source
'';

postPatch = ''
substituteInPlace Makefile --replace sudo ""
'';

makeFlags = [ "PREFIX=$(out)" ];
};
in {
config = {
nixpkgs.config.packageOverrides = pkgs: { kr = kr; };
};
}

完整的错误信息在这里。

# use rsync so that file modifed times are only updated when the contents change
cd dashboard_yew && cargo web deploy --release --target=wasm32-unknown-emscripten && rsync --checksum --delete -r ../target/deploy/* ../target/deploy-final
error: warning: replace for the non root package will be ignored, specify replace at the workspace root:
package: /build/src/github.com/kryptco/kr/sigchain/sigchain_client/Cargo.toml
workspace: /build/src/github.com/kryptco/kr/sigchain/Cargo.toml
Updating crates.io index
warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name; class=Net (12)
warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name; class=Net (12)
error: failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
[6] Couldn't resolve host name; class=Net (12)

make[1]: *** [Makefile:25: libsigchain-with-dashboard] Error 101
make[1]: Leaving directory '/build/src/github.com/kryptco/kr/sigchain'
make: *** [Makefile:71: all] Error 2
builder for '/nix/store/78r0kh34ljzgfx658f9n99f8lxydjfxy-kr.drv' failed with exit code 2

最佳答案

我认为您不会绕过配置文件的 [replace] 编辑。 cargo web deploy 中的构建失败是由于 openssl-sys 版本过时(已停产)。 Here's how Parity fixed it .看起来他们编辑了 Cargo.lock 文件以依赖于这个库的更新版本。

关于rust - nixos:我的自定义包派生在 `cargo build` 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55996879/

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