Skip to content

[bzlmod] Failed to parse label from string #2426

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

Closed
mering opened this issue Jan 16, 2024 · 0 comments · Fixed by #2427
Closed

[bzlmod] Failed to parse label from string #2426

mering opened this issue Jan 16, 2024 · 0 comments · Fixed by #2427

Comments

@mering
Copy link

mering commented Jan 16, 2024

When using the following cargo config in my MODULE.bazel:

use_repo(non_module_deps, "zenohd")
crate.from_cargo(
    name = "zenohd_deps",
    cargo_lockfile = "//third_party/zenoh:zenohd.Cargo.lock",
    manifests = ["@zenohd//:Cargo.toml"],
)

I do get the following error:

ERROR: Traceback (most recent call last):
        File "/home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/external/rules_rust~override/crate_universe/extension.bzl", line 227, column 37, in _crate_impl
                _generate_hub_and_spokes(module_ctx, cargo_bazel, cfg, annotations)
        File "/home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/external/rules_rust~override/crate_universe/extension.bzl", line 85, column 16, in _generate_hub_and_spokes
                cargo_bazel([
        File "/home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/external/rules_rust~override/crate_universe/private/module_extensions/cargo_bazel_bootstrap.bzl", line 51, column 17, in run
                fail("%s returned with exit code %d:\n%s" % (pretty_args, result.return_code, result.stderr))
Error in fail: /home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/external/rules_rust~override~cargo_bazel_bootstrap~cargo_bazel_bootstrap/cargo-bazel splice --output-dir /home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/modextwd/rules_rust~override~crate/zenohd_deps/splicing-output --config /home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/modextwd/rules_rust~override~crate/zenohd_deps/config.json --splicing-manifest /home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/modextwd/rules_rust~override~crate/zenohd_deps/splicing_manifest.json --cargo-lockfile /workspaces/insrc/third_party/zenoh/zenohd.Cargo.lock --cargo /home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/external/rules_rust~override~rust~rust_host_tools/bin/cargo --rustc /home/builder/.cache/bazel/_bazel_builder/395eea75460def8a11dd35795d615210/external/rules_rust~override~rust~rust_host_tools/bin/rustc returned with exit code 1:
Error: Failed to load SplicingManifest

Caused by:
    Failed to parse label from string: @@_main~non_module_deps_ext~zenohd//:Cargo.toml at line 5 column 188
illicitonion added a commit to illicitonion/rules_rust that referenced this issue Jan 16, 2024
illicitonion added a commit that referenced this issue Jan 16, 2024
daivinhtran pushed a commit to daivinhtran/rules_rust that referenced this issue Jan 17, 2024
daivinhtran pushed a commit to daivinhtran/rules_rust that referenced this issue Jan 17, 2024
Drop import macro (bazelbuild#2411)

As discussed over at
bazelbuild#2383

Fix rustfmt toolchains when consuming rules_rust with bzlmod. (bazelbuild#2410)

Fixes bazelbuild#2260

Provide a better error message when trying to generate rust-project.json (bazelbuild#2196)

Currently when trying to generate a `rust-project.json`, if there aren't
actually any Rust targets defined, the script mysteriously fails.

This adds a better error message.

Update android example to use Starlark version of android_ndk_repository (bazelbuild#2417)

The native version of `android_ndk_repository` rule no longer work with
the newer ndk versions.

When I set `ANDROID_NDK_HOME` to
`/usr/local/vinhdaitran/Android/Sdk/ndk/26.1.10909125`, the rule expects
a different structure from the Android NDK path.
```
ERROR: /usr/local/vinhdaitran/github/rules_rust/examples/android/WORKSPACE.bazel:67:23: fetching android_ndk_repository rule //external:androidndk: java.io.IOException:
Expected directory at /usr/local/vinhdaitran/Android/Sdk/ndk/26.1.10909125/platforms but it is not a directory or it does not exist.
Unable to read the Android NDK at /usr/local/vinhdaitran/Android/Sdk/ndk/26.1.10909125, the path may be invalid. Is the path in android_ndk_repository() or ANDROID_NDK_HOME set correctly?
If the path is correct, the contents in the Android NDK directory may have been modified.
```

Using the Starlark version of the rule, as recommended in
https://bazel.build/reference/be/android#android_ndk_repository, fixes
the issue.

cc: @keith

Allow ~ in repository names (bazelbuild#2427)

Fixes bazelbuild#2426

Prepare rust rules for Starlark CcToolchainInfo. (bazelbuild#2424)

bazelbuild#2425
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 a pull request may close this issue.

1 participant