bazelbuild / bazelbuild/rules_rust

`crate_vendor` does not work from the root package

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

Description

I'm trying to set up a project that can be built with both cargo and bazel. The repo is at https://github.com/prestontw/bazel-rust-vendored-experiment/tree/return-to-rust-rules

I'm trying to vendor external dependencies, but when I do, I see:
```
% bazel run //:crates_vendor
INFO: Analyzed target //:crates_vendor (1 packages loaded, 2 targets configured).
INFO: Found 1 target...
Target //:crates_vendor up-to-date:
bazel-bin/crates_vendor.sh
INFO: Elapsed time: 0.124s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action

error: failed to sync

Caused by:
failed to create directory `/crates`

Caused by:
Read-only file system (os error 30)

Error: Failed to vendor dependencies

Caused by:
Failed to vendor sources with: exit status: 101
```
I see the same error if I rely on the default value.

From the error message and the directory path, it seems like the path is absolute rather than relative to the workspace. Indeed, specifying the vendor path as an absolute path (`/User/preston/git/bazel-experiment/crates`) works.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.