Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo build/.cargo/config deprecation note #334857

Open
VuiMuich opened this issue Aug 15, 2024 · 1 comment
Open

Cargo build/.cargo/config deprecation note #334857

VuiMuich opened this issue Aug 15, 2024 · 1 comment
Labels
0.kind: bug Something is broken 6.topic: rust

Comments

@VuiMuich
Copy link
Contributor

Describe the bug

Since a recent update of cargo (I suspect it was with 1.80.0 but I didn't research it yet, as I suppose at this point it isn't really relevant) cargo prints a warning when cargoBuildHook is executed.
Here is an example from building the termusic package:

termusic> warning: `/build/.cargo/config` is deprecated in favor of `config.toml`
termusic> note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
termusic> warning: `/build/.cargo/config` is deprecated in favor of `config.toml`
termusic> note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`

Steps To Reproduce

Steps to reproduce the behavior:
Build any Rust package based on nixpkgs-unstable (or nixpkgs/master).

Expected behavior

The relevant build support scripts of nixpkgs should be updated to store the cargo config as suggested by the deprecation note.
If necessary, the script should check if an older cargo version then 1.38 is used and in case symlink like suggested as well.

Additional context

Here are the uses of .cargo/config I could find with rg in pkgs/build-support/rust/, but I am not sure if that is sufficient or if there are some hidden place I might have missed with this cursory search:

>>> rg ".cargo/config" ./pkgs/build-support/rust/
./pkgs/build-support/rust/test/import-cargo-lock/basic-sparse/default.nix
12:      ./.cargo/config.toml

./pkgs/build-support/rust/hooks/cargo-setup-hook.sh
25:    config="$cargoDepsCopy/.cargo/config";
33:    cat ${tmp_config} >> .cargo/config
35:    cat >> .cargo/config <<'EOF'

./pkgs/build-support/rust/import-cargo-lock.nix
232:    cat > $out/.cargo/config <<EOF
243:      cat >> $out/.cargo/config <<EOF
259:          cat "$crate/.cargo-config" >> $out/.cargo/config

./pkgs/build-support/rust/fetch-cargo-tarball/default.nix
76:    # Override the `http.cainfo` option usually specified in `.cargo/config`.
99:    install -D $CARGO_CONFIG $name/.cargo/config;

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.3, NixOS, 24.11 (Vicuna), 24.11.20240814.c3aa7b8`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"home-manager-23.05.tar.gz, nixos-23.05"`
 - channels(vuimuich): `""`
 - nixpkgs: `/nix/store/4cpakzyvfw1rmm9v5i3387x6jd2h1v86-source`

Generally I would be interested in attempting a fix myself, but I am sure I cannot pick it up before the next four weeks, so if in the meantime someone else wants to fix this, please go ahead.

Add a 👍 reaction to issues you find important.

@whs-dot-hk
Copy link

Hi I got this error building aws_sdk_s3 1.71.0, anyone know how to fix it? Thanks

       > error: failed to run custom build command for `crc64fast-nvme v1.1.1`
       >
       > Caused by:
       >   process didn't exit successfully: `/build/8x3f6j58l84xgdl6rrxb5viigi6y7vgv-source/target/release/build/crc64fast-nvme-0f255d997c7dc5e2/build-script-build` (exit status: 101)
       >   --- stderr
       >
       >   thread 'main' panicked at /build/artifact-loader-1.0.0-vendor.tar.gz/crc64fast-nvme/build.rs:9:10:
       >   Unable to generate C bindings.: CargoMetadata("/build/artifact-loader-1.0.0-vendor.tar.gz/crc64fast-nvme/Cargo.toml", Metadata(Output { status: ExitStatus(unix_wait_status(25856)), stdout: "", stderr: "warning: `/build/artifact-loader-1.0.0-vendor.tar.gz/.cargo/config` is deprecated in favor of `config.toml`\nnote: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`\nerror: failed to get `crc` as a dependency of package `crc64fast-nvme v1.1.1 (/build/artifact-loader-1.0.0-vendor.tar.gz/crc64fast-nvme)`\n\nCaused by:\n  failed to load source for dependency `crc`\n\nCaused by:\n  Unable to update registry `crates-io`\n\nCaused by:\n  failed to update replaced source registry `crates-io`\n\nCaused by:\n  failed to read root of directory source: /build/artifact-loader-1.0.0-vendor.tar.gz/@vendor@\n\nCaused by:\n  No such file or directory (os error 2)\n" }))
       >   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
       > warning: build failed, waiting for other jobs to finish...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: rust
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants