-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
The built release by cargo build -r
has the wrong format (Malformed Mach-o file) on MacOS aarch64-apple-darwin
#13683
Comments
I find out why I failed to install |
Adding these lines in [build]
target = "aarch64-apple-darwin" However, do I have a permanent approach? |
Could you run Could you also try the latest nightly with the This might be relevant: rust-lang/rust#122902. Also #11641 |
IIRC this is https://stackoverflow.com/a/74686115 which is related to homebrew's binutils and has nothing to do with Cargo, at least not directly:
Of course, since v1.77, Cargo has been invoking |
Work for me! Thanks! |
Thanks! If I use |
In my case, |
Thanks for help verify it. As it is expected and we've found the root cause, I am going to close this. |
Problem
I wrote a rust program with default settings and no dependencies. It run perfectly when I used
cargo build
to build it.I run
cargo build -r
to build a release version and tried to run it. However, the program was immediately killed by system (SIGKILL). I tried to run it with lldb, only to finderror: Malformed Mach-o file
.I use
file
to find out why and getMach-O executable arm64
(expectedMach-O 64-bit executable arm64
), which means the executable file is 32-bit but claim to be executable on arm64.I tried to build with
cargo build -r --target aarch64-apple-darwin
and the program run perfectly. However I confirm that I only have one target (aarch64-apple-darwin) installed. My environments as follows:Steps
cargo run
to confirm the program run perfectly when building by debug. (optional)cargo run -r
to find program is killed by system.file target/release/<project_name>
to find the executable file is 32-bit.cargo run -r --target aarch64-apple-darwin
finding program run perfectly.Possible Solution(s)
No response
Notes
I installed cargo about a month ago.
cargo run -r
run perfectly at that time. I tried to installwasm-pack
a few days ago but failed (I'm not sure why). I am not sure whetherwasm-pack
affect this.Version
The text was updated successfully, but these errors were encountered: