cargo-zigbuild icon indicating copy to clipboard operation
cargo-zigbuild copied to clipboard

`universal2-apple-darwin` panics under workspace

Open elringus opened this issue 1 year ago • 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: https://github.com/rust-cross/cargo-zigbuild/blob/ca7f11de0929e1e0d9a7fa30864d39a5c480d64f/src/build.rs#L79

elringus avatar Mar 06 '24 14:03 elringus

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

messense avatar Mar 07 '24 02:03 messense

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!

elringus avatar Mar 07 '24 07:03 elringus