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

Added Rust 1.82.0 #2944

Merged
merged 8 commits into from
Oct 21, 2024
Merged

Added Rust 1.82.0 #2944

merged 8 commits into from
Oct 21, 2024

Conversation

UebelAndre
Copy link
Collaborator

@@ -6,6 +6,11 @@ rust_library(
srcs = glob(["src/**/*.rs"]),
aliases = aliases(),
proc_macro_deps = all_crate_deps(proc_macro = True),
# TODO: https://github.com/bazelbuild/rules_rust/issues/2947
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@UebelAndre UebelAndre added this pull request to the merge queue Oct 21, 2024
Merged via the queue into bazelbuild:main with commit f213d28 Oct 21, 2024
4 checks passed
@avdv
Copy link

avdv commented Nov 7, 2024

When using rules_rust 0.54, we see this error:

ERROR: An error occurred during the fetch of repository 'cargo_bazel_bootstrap':
   Traceback (most recent call last):
        File "/home/runner/.cache/bazel/_bazel_runner/962535b5b03441543344ad7194339468/external/rules_rust/cargo/private/cargo_bootstrap.bzl", line 218, column 35, in _cargo_bootstrap_repository_impl
                built_binary = cargo_bootstrap(
        File "/home/runner/.cache/bazel/_bazel_runner/962535b5b03441543344ad7194339468/external/rules_rust/cargo/private/cargo_bootstrap.bzl", line 93, column 13, in cargo_bootstrap
                fail(_FAIL_MESSAGE.format(
Error in fail: Process exited with code '101'
# ARGV ########################################################################
[/home/runner/.cache/bazel/_bazel_runner/962535b5b03441543344ad7194339468/external/nix_rust/bin/cargo, "build", "--bin", "cargo-bazel", "--locked", "--target-dir", /home/runner/.cache/bazel/_bazel_runner/962535b5b03441543344ad7194339468/external/cargo_bazel_bootstrap, "--manifest-path", /home/runner/.cache/bazel/_bazel_runner/962535b5b03441543344ad7194339468/external/rules_rust/crate_universe/Cargo.toml, "--release"]
# STDOUT ######################################################################
# STDERR ######################################################################
    Updating crates.io index
 Downloading crates ...
  Downloaded adler v1.0.2
  Downloaded autocfg v1.1.0
  Downloaded camino v1.1.9
...
  Downloaded allocator-api2 v0.2.18
error: package `normpath v1.3.0` cannot be built because it requires rustc 1.74.0 or newer, while the currently active rustc version is 1.73.0
Either upgrade to rustc 1.74.0 or newer, or use
cargo update -p [email protected] --precise ver
where `ver` is the latest version of `normpath` supporting rustc 1.73.0

This seems due to this change. Does this mean rustc < 1.74.0 is no longer supported?

@illicitonion
Copy link
Collaborator

No - our CI tests that rustc 1.72.1 is supported:

- sed -i 's|^rust_register_toolchains(|rust_register_toolchains(versions = ["1.72.1"],\n|' WORKSPACE.bazel
- I'm not sure why you'd be seeing something different.

@avdv
Copy link

avdv commented Nov 15, 2024

Well, we are using crate_universe_dependencies(bootstrap = True, ...) because the cargo-bazel binary provided by the release artifacts does not run on NixOS.

I see there is a static binary build with musl which would work, but this is never used automatically, AFAICS.

I can work around with:

load("@rules_rust//crate_universe/private:urls.bzl", "CARGO_BAZEL_URLS", "CARGO_BAZEL_SHA256S")

crates_repository(
    ...
    generator_urls = CARGO_BAZEL_URLS | {
        "x86_64-unknown-linux-gnu": CARGO_BAZEL_URLS["x86_64-unknown-linux-musl"],
    },
    generator_sha256s = CARGO_BAZEL_SHA256S | {
        "x86_64-unknown-linux-gnu": CARGO_BAZEL_SHA256S["x86_64-unknown-linux-musl"],
    },
)

but that leads to a different error when repinning:

Error in fail: Command [/home/claudio/.cache/bazel/_bazel_claudio/2fef88099e02b50d30aa33e59040bc18/external/crate_index/cargo-bazel, "splice", "--output-dir", /home/claudio/.cache/bazel/_bazel_claudio/2fef88099e02b50d30aa33e59040bc18/external/crate_index/splicing-output, "--splicing-manifest", /home/claudio/.cache/bazel/_bazel_claudio/2fef88099e02b50d30aa33e59040bc18/external/crate_index/splicing_manifest.json, "--config", /home/claudio/.cache/bazel/_bazel_claudio/2fef88099e02b50d30aa33e59040bc18/external/crate_index/cargo-bazel.json, "--cargo", /home/claudio/.cache/bazel/_bazel_claudio/2fef88099e02b50d30aa33e59040bc18/external/nix_rust/bin/cargo, "--rustc", /home/claudio/.cache/bazel/_bazel_claudio/2fef88099e02b50d30aa33e59040bc18/external/nix_rust/bin/rustc, "--cargo-lockfile", /home/claudio/source/rules_nixpkgs/examples/toolchains/rust/Cargo.lock] failed with exit code 1.
STDOUT ------------------------------------------------------------------------

STDERR ------------------------------------------------------------------------

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/tmp/.tmpBvflpe/cargo_tree_rustc_wrapper.sh /home/claudio/.cache/bazel/_bazel_claudio/2fef88099e02b50d30aa33e59040bc18/external/nix_rust/bin/rustc - --crate-name ___ --print=file-names --target wasm32-wasip1 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1)
  --- stderr
  error: Error loading target specification: Could not find specification for target "wasm32-wasip1". Run `rustc --print target-list` for a list of built-in targets

Seems like the cargo-bazel binary assumes a target that is not supported by rustc 1.73.0 ?

λ /home/claudio/.cache/bazel/_bazel_claudio/2fef88099e02b50d30aa33e59040bc18/external/nix_rust/bin/rustc --print target-list | grep wasm
wasm32-unknown-emscripten
wasm32-unknown-unknown
wasm32-wasi
wasm32-wasi-preview1-threads
wasm64-unknown-unknown

.... OK, I can set the supported_platform_triples attribute to the desired / supported triples.

How do you think about using the musl binary by default (and drop the gnu binary as it has no added value and is even slightly larger)?

@illicitonion
Copy link
Collaborator

I'd be happy to switch to the musl binary - want to send a PR? :)

@avdv
Copy link

avdv commented Nov 26, 2024

I'd be happy to switch to the musl binary - want to send a PR? :)

Sure, I'll look into that. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants