-
Notifications
You must be signed in to change notification settings - Fork 403
fix: exclude WASI example from workspace to avoid linker errors #541
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
fix: exclude WASI example from workspace to avoid linker errors #541
Conversation
…c/arm64 Cargo uses the macOS host linker for workspace builds, but that linker cannot resolve WASI WebAssembly imports (such as _wasi:cli/run@0.2.x). As a result, including a WASI crate in the workspace causes builds to fail on macOS systems using arm64. Solution: Mark the WASI example as non-default by excluding it from the workspace members. This makes the WASI package optional, so `cargo build` won't touch it, and it can be built explicitly when needed with: cargo build -p wasi-mcp-example --target wasm32-wasip2 Signed-off-by: tanish111 <tanishdesai37@gmail.com>
|
@tanish111 Need to look into: |
Replace workspace inheritance with explicit values in examples/wasi/Cargo.toml since excluded packages cannot inherit from workspace. This fixes CI manifest parsing errors when building WASI example explicitly. Signed-off-by: tanish111 <tanishdesai37@gmail.com>
|
@alexhancock The problem was that examples/wasi/Cargo.toml used { workspace = true }, |
|
Can we look into not excluding the wasi example from the workspace, but instead using https://doc.rust-lang.org/cargo/reference/workspaces.html#the-members-and-exclude-fields If we add everything to |
|
@alexhancock we can do that but in that case we would need to maintain a long list of Moreover whenever someone adds new example he would also need to make changes to Cargo.toml. Is that what we want ? |
|
I think there are other problems with doing it this way, like all the info is now duplicated into the wasi example's I think the best solution is probably: this way, only "crates/rmcp", "crates/rmcp-macros"` will be operated on by default with local commands, then in CI we can make sure we run tests/etc against everything. Then the wasi example can be part of the workspace without causing any issue. |
|
@alexhancock got it |
Only core crates are built by default, preventing WASI linker errors on macOS while keeping it in workspace for property inheritance. Signed-off-by: tanish111 <tanishdesai37@gmail.com>
|
@alexhancock I have made the changes |
alexhancock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd update the title so we have a more accurate thing in PR history, but lgtm!
|
@alexhancock @jokemanfire Thanks |
Motivation and Context
Cargo uses the macOS host linker for workspace builds, but that linker cannot
resolve WASI WebAssembly imports (such as _wasi:cli/run@0.2.x). As a result,
including a WASI crate in the workspace causes builds to fail on macOS systems
using arm64.
Solution: Mark the WASI example as non-default by excluding it from the workspace
members. This makes the WASI package optional, so
cargo buildwon't touch it,and it can be built explicitly when needed with:
cargo build -p wasi-mcp-example --target wasm32-wasip2How Has This Been Tested?
Now cargo build works fine on Mac/arm64
Types of changes
Checklist
Additional context
CI will continue to build the WASI example explicitly during release workflows.