embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
5.48k stars 765 forks source link

Build fails when using a workspace #1165

Closed cgudrian closed 1 year ago

cgudrian commented 1 year ago

When building an Embassy project from within a Cargo workspace the build fails with

Compiling stm32-metapac v0.1.0 (https://github.com/embassy-rs/embassy.git#825b6710)
LLVM ERROR: Global variable '__INTERRUPTS' has an invalid section specifier '.vector_table.interrupts': mach-o section specifier requires a segment and section separated by a comma.

Rust is building the crate stm32-metapac for the host instead of the target platform (which can be confirmed by looking at the verbose build output).

When removing the Cargo.toml file with the workspace declaration the build succeeds.

I've made a minimal example that exposes this behavior.

Note: I am on macOS.

Dirbaio commented 1 year ago

Make sure you have resolver="2" in the [workspace].

cgudrian commented 1 year ago

That, of course, does the trick. Thanks for the quick help!