rust-cross / cargo-zigbuild

Compile Cargo project with zig as linker
MIT License
1.45k stars 52 forks source link

Is it possible to use a custom strip path? #111

Closed Dreamacro closed 1 year ago

Dreamacro commented 1 year ago

Because the strip in SDKROOT sucks, it will fail to strip when building aarch64-apple-darwin/x86_64-apple-darwin. llvm-strip works well.

warning: stripping debug info with `strip` failed: exit status: 1
  |
  = note: /Library/Developer/CommandLineTools/usr/bin/strip: fatal error: file not in an order that can be processed (function starts data out of place): /Users/dreamacro/Dev/projects/****/target/x86_64-apple-darwin/release/deps/ctl-274200c28898526f

I tried to use TARGET_STRIP=llvm-strip cargo zigbuild --release --target universal2-apple-darwin but it doesn't work, is this possible?

messense commented 1 year ago

strip command is controlled by rustc, so you should raise an issue in rust-lang/rust instead.

Dreamacro commented 1 year ago

But the warning only appears in zigbuild.

cargo build --release --target x86_64-apple-darwin works well and have been strip.

cargo zigbuild --release --target x86_64-apple-darwin emit strip warning and binary not strip

messense commented 1 year ago

Probably because your default sdk is from CLT not Xcode, xcrun --show-sdk-path --sdk macosx should give some hints.

And if cargo build works for you, then you don't need to use cargo zigbuild for this target, right?

Dreamacro commented 1 year ago

Yes, I just used CLT. The reason I want to use zigbuild is that universal2-apple-darwin, which is easier than merging manually.

messense commented 1 year ago

Maybe you can try SDKROOT="" cargo zigbuild to opt out of using the CLT SDK, but I'm not sure if it works.

Dreamacro commented 1 year ago

Maybe you can try SDKROOT="" cargo zigbuild to opt out of using the CLT SDK, but I'm not sure if it works.

It doesn't work. But thank you for your help