rust-cross/cargo-zigbuild

`universal2-apple-darwin` panics under workspace

elringus opened this issue · 2 comments

When building with --target=universal2-apple-darwin under workspace:

thread 'main' panicked at src/build.rs:79:48:
Should have a root package                   
stack backtrace:                             
   0: rust_begin_unwind                                                                            
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5 
   1: core::panicking::panic_fmt                                                                   
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_display                                                               
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:178:5
   3: core::panicking::panic_str                                                                   
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:152:5
   4: core::option::expect_failed
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/option.rs:1985:5
   5: cargo_zigbuild::build::Build::execute
   6: cargo_zigbuild::main

This is probably due to universal2-apple-darwin being handled separately from other targets and it expects root package, which doesn't exist in workspace projects:

let root_pkg = metadata.root_package().expect("Should have a root package");

This doesn't look like an easy fix, does passing --manifest-path work for you?

This doesn't look like an easy fix, does passing --manifest-path work for you?

This works, but each crate in the workspace has to be build separately, as only one manifest can be specified at a time. Not a big deal though, thanks for the hint!