A workspace member with several crate types fails builds of unrelated packages
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- build-system
調査の方向性
Start by locating the client-side workspace crate-type check: the report says it runs before the daemon starts and appears to inspect every workspace member. Trace how cargo rustd build -p app selects packages, then compare that with the crate-type validation. Done means the unrelated ffi member no longer blocks app; the report also describes the expected behavior when ffi is a dependency.
索引モデルが issue の本文から書いたものです。
説明
Summary
cargo rustd build -p <crate> fails for the whole workspace when any workspace member declares more than one crate type, for example crate-type = ["lib", "cdylib", "staticlib"]. The failing member does not need to be a dependency of the crate being built.
This pattern is common for crates that expose an FFI surface (UniFFI, cbindgen, JNI) and also keep a lib target for Rust consumers.
Reproduction
Environment: macOS arm64 (Darwin), rustd from the nightly release, Rust 1.99.0 with rust-src.
Create a workspace with two members. app is a plain binary. ffi is a library with three crate types. app does not depend on ffi.
Cargo.toml
[workspace]
members = ["app", "ffi"]
resolver = "3"
ffi/Cargo.toml
[package]
name = "ffi"
version = "0.1.0"
edition = "2024"
[lib]
crate-type = ["lib", "cdylib", "staticlib"]
ffi/src/lib.rs
pub fn add(a: u32, b: u32) -> u32 {
a + b
}
app/Cargo.toml
[package]
name = "app"
version = "0.1.0"
edition = "2024"
app/src/main.rs
fn main() {
println!("{}", 1 + 2);
}
Then run:
cargo +1.99.0 rustd build -p app
Actual result
error: `ffi` is built as `lib` and `cdylib` and `staticlib`, which the daemon does not link yet: it builds a `lib`, an `rlib` or a `bin` alone
Expected result
Either of these would help:
- Building
appsucceeds, becauseffiis not in its dependency graph. - If
ffiis a dependency,rustdbuilds itslibtarget and ignores thecdylibandstaticliboutputs when no requested target needs them.
Notes from isolating it
| Variant | Result |
|---|---|
Both crates are workspace members, ffi has three crate types |
Fails, error above |
ffi removed from members (so it is not in the workspace) |
cargo rustd build -p app succeeds |
Both are members, ffi has the default crate type |
cargo rustd build -p app succeeds |
So the check seems to run over every workspace member, not only the packages selected by -p or the dependencies of those packages. I have not read the source, so this is an inference from the behavior.
I also saw that the error is printed even when the daemon is not running (cargo rustd stop reports daemon: not running), so the check looks like it happens in the client before the daemon starts. This is from observation only.
Why it matters
The README already lists "workspace crates built as cdylib, dylib or staticlib" under "What is not supported", so I understand this is a known limit. The part that may be unintended is its reach. A workspace that ships an FFI crate next to other packages cannot use rustd at all today, even for packages that do not touch that crate. The README does not say that the check applies to the whole workspace.
Related: #1 (macOS support). The trivial workspace above builds and runs under rustd on macOS arm64 once ffi is excluded, which is useful data for that issue.
Happy to test a fix or a branch.
- 主要言語
- Rust
- スター
- 248
- フォーク
- 13
- 平均マージ
- 7時間 52分
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DioxusLabs/rustd のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
DioxusLabs/rustd#15 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
DioxusLabs/rustd#28 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
DioxusLabs/rustd#27 ·
メンテナーはふだん 1 日以内に返信
-
Workspace fails to load: rquickjs types give layout of …: HasErrorType, and rustd never falls backオープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
DioxusLabs/rustd#26 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
DioxusLabs/rustd#25 ·
メンテナーはふだん 1 日以内に返信
DioxusLabs/rustd の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
mongodb/kingfisher#588 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
bug rust
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
franciscoBSalgueiro/en-croissant#1111 ·
メンテナーはふだん 2 日以内に返信
-
[bug] Toolchain versions from `.prototools` are not inherited when moon runs from a subdirectoryオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信