-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary compiled with dontStrip = true
crashes
#417
Comments
dontStrip = true
crashes
Hey. We have hit the same issue. I don't think it's a crane issue though. Probably some weird-o-security thing on Macs. I vaguely recall that upgrading rustc fixed it too. |
Possibly something to do with codesigning on darwin? I've seen a bunch of places were this was handled in Rust is |
Yes. Something like that. I'm not an expert in unfree OSes, but I had to deal with SIPs and other problems around it in the past.
I might have been wrong. Seems like we still have
|
Setting |
Ooohhhhh. I didn't know that. OK then. Crane's fault. I think crane is using binary substitution to override some debug paths in the final binary files that would link the binaries with vendored source code, making Nix consider vendored source code a Nix dependency for your binaries. I guess it trips some integrity checks / checksums somewhere? Oh that might be a PITA to undo. THough maybe crane should just |
Ok I can confirm it's just a signing issue. I added this to my
This triggers the codesigning hook here: https://github.com/NixOS/nixpkgs/blob/5dcafc36852cd8d96127f5cbfe42918bf262214e/pkgs/build-support/remove-references-to/default.nix#L27-L29 So we basically just have to replicate this in |
Oh. So maybe it's just a matter of order of operations? Does crane need to do it before signing happens? |
It doesn't seem so. I ran the build with |
Fyi, to fix this you just have to |
I thought the scope inherited all of content of pkgs automatically. But if I'm wrong, you can just add whatever you need to the scope anyway. |
Nevermind, it seems everything is already there. I just got confused because |
Sorta unrelated and not really a crane issue imo, but I did notice that with |
@simonzkl feel free to update the docs or the FAQs with that bit if info! |
Promoted to separated issue #428 even if just for visibility and search engines. |
I was trying to add debug symbols to my
release
binary and I noticed the binary compiled with crane anddontStrip = true
crashes on startup.Example project: https://github.com/simonzkl/crane-dont-strip
Steps to reproduce:
nix run -L
Killed: 9
Using
cargo build
innix-shell
works fine:nix develop -c -- cargo run --release
Note that this only seems to happen when you link with external dependencies like
openssl
.Setting
doNotRemoveReferencesToVendorDir = true
fixes the issue, so it looks like crane patches something that makes MacOS freak out.I only tested this on
aarch64-darwin
.The text was updated successfully, but these errors were encountered: