rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker
MIT License
1.35k stars 50 forks source link

`universal2-apple-darwin` panics under workspace #230

Open elringus opened 4 months ago

elringus commented 4 months ago

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

messense commented 4 months ago

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

elringus commented 4 months ago

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!