bazelbuild / bazelbuild/rules_rust

Package files not accessible through env path injected through annotation

Open
#1,978 1 comment 0 reactions 0 assignees View on GitHub
crate-universe needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

I am using http_archive to download third-party packages containing libraries, so I needed to compile my Rust binary.

In the `crates_repository` rule, I added `annotation` that includes the environment variables that cargo needs to compile the rust crate. In the environment variable, I specified in the format like this pointing to the library path: `$(location @//pkg:file)`. However, rust cannot access these files with the error `file not found`.

Am I missing something? Can some one point me to the right solution to this?

Thanks

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with an http_archive package and the crates_repository annotation, using an environment variable containing `$(location @//pkg:file)`. Trace how that location is passed to the Rust compilation environment and compare the resolved path with the package file. Done means the Rust binary can access the annotated library path without a file-not-found error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.