Comments (14)
You will need to run cargo clean
before trying to run cargo run
again.
from rust.
The issue seems to have started in +nightly-2024-01-18
:
$ cargo +nightly-2024-01-18 run --release
Finished release [optimized] target(s) in 0.16s
Running `target/release/demo`
Killed: 9
But this one works using +nightly-2024-01-17
$ cargo +nightly-2024-01-17 run --release
Finished release [optimized] target(s) in 0.16s
Running `target/release/demo`
Hello, world!
from rust.
I have the exact same software versions, but I am unable to reproduce this. Could you try running the binaries under gdb
/lldb
to see where the SIGKILL
gets generated?
from rust.
lldb reports that it's an invalid mach-o file.
$ cargo +1.77 run --release
Finished release [optimized] target(s) in 0.02s
Running `target/release/demo`
Killed: 9
$ lldb target/release/demo
(lldb) target create "target/release/demo"
Current executable set to '/Users/greg/scratch/demo/target/release/demo' (arm64).
(lldb) r
error: Malformed Mach-o file
(lldb)
However, objdump seems to show that the mach-o file is fine:
$ file target/release/demo
target/release/demo: Mach-O executable arm64
$ objdump -f target/release/demo
target/release/demo: file format mach-o-arm64
architecture: aarch64, flags 0x00000012:
EXEC_P, HAS_SYMS
start address 0x0000000000001ad0
lldb works with a --profile dev
binary
$ cargo +1.77 run --profile dev
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/demo`
Hello, world!
$ lldb target/debug/demo
(lldb) target create "target/debug/demo"
Current executable set to '/Users/greg/scratch/demo/target/debug/demo' (arm64).
(lldb) r
Process 14925 launched: '/Users/greg/scratch/demo/target/debug/demo' (arm64)
Hello, world!
Process 14925 exited with status = 0 (0x00000000)
(lldb)
from rust.
That looks like a linker issue. Do you have any linker overrides (e.g. in ~/.cargo/config.toml
)?
from rust.
Nothing there. I rm -rf ~/.cargo ~/.rustup
and start from scratch installing from rustup.rs.
$ rustup show
Default host: aarch64-apple-darwin
rustup home: /Users/greg/.rustup
installed toolchains
--------------------
stable-aarch64-apple-darwin (default)
1.76-aarch64-apple-darwin
1.77-aarch64-apple-darwin
active toolchain
----------------
stable-aarch64-apple-darwin (default)
rustc 1.77.0 (aedd173a2 2024-03-17)
/Users/greg/.cargo
├── bin
│ ├── cargo
│ ├── cargo-clippy
│ ├── cargo-fmt
│ ├── cargo-miri
│ ├── clippy-driver
│ ├── rls
│ ├── rust-analyzer
│ ├── rust-gdb
│ ├── rust-gdbgui
│ ├── rust-lldb
│ ├── rustc
│ ├── rustdoc
│ ├── rustfmt
│ └── rustup
├── env
└── env.fish
2 directories, 16 files
Still see the same SIGKILL from the OP.
In case it matters, on a MacBook Apple M2 Pro
from rust.
Ok, so it's the default linker. What does ld -v
say for you?
from rust.
@(#)PROGRAM:ld PROJECT:ld-1053.12
BUILD 15:45:29 Feb 3 2024
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.3.2.2)
from rust.
I have a suspicion it might involve having the wrong strip
in PATH
, which can happen with homebrew. which strip
should be /usr/bin/strip
.
from rust.
Good suspicion! Indeed, a homebrew strip is found first. However, tweaking the path doesn't seem to fix the problem:
$ which strip
/opt/homebrew/opt/binutils/bin/strip
$ PATH=/usr/bin:$PATH which strip
/usr/bin/strip
$ PATH=/usr/bin:$PATH cargo +1.77 run --release
Finished release [optimized] target(s) in 0.02s
Running `target/release/demo`
Killed: 9
from rust.
UPDATE: I forgot to do a clean before re-doing the build. Indeed changing the path for strip does fix the issue:
$ cargo clean
Removed 17 files, 1.0MiB total
$ PATH=/usr/bin:$PATH cargo +1.77 run --release
Compiling demo v0.1.0 (/Users/greg/scratch/demo)
Finished release [optimized] target(s) in 0.78s
Running `target/release/demo`
Hello, world!
Thank you!
from rust.
In case it's useful, here's a diff of the good (left) vs bad (right) binaries.
One thing I noticed is that the bad one (right) has a magic number of 0xfeedface
, which I believe should be used for 32-bit executables. So maybe that's the problem, not sure.
Thank you both very much for helping debug this! Much appreciated!
from rust.
It might be related to this issue:
https://blogs.oracle.com/java/post/java-on-macos-14-4
This can explain why you received SIGKILL
from rust.
It might be related to this issue: https://blogs.oracle.com/java/post/java-on-macos-14-4 This can explain why you received SIGKILL
I think that's a different issue.
The issue that @joboet and @ehuss helped track down was due to using my machine using strip
from homebrew. That strip from homebrew binutils does not work correctly on macOS, apparently. Though it seems to have worked until Rust 1.77 (likely until rust-lang/cargo#13257).
It may be nice if cargo warned if /usr/bin/strip
is not used, but I'll let you folks decide if there's anything to be done about this. For now, my problem has been diagnosed and fixed on my end.
Thanks again for the help, folks!
from rust.
Related Issues (20)
- Missed optimization with reserve and extend_from_slice
- --crate-type=bin causes no_mangle symbols to be ommitted. HOT 4
- Internal compiler error when copying value of normally copyable type under `no_core` HOT 1
- ICE: `type variables should not be hashed?` HOT 1
- ICE: const generic with default const expr specified before type generic causes compiler to crash HOT 1
- ICE: virtual-function-elimination HOT 1
- rust-1.72.1 Unable to compile HOT 2
- ICE when using offset_of! in generic_const_exprs
- Miri reports leak in thread local allocation HOT 4
- Upgrade the Node.js version to 20
- split-debuginfo="unpacked" results in executables that still have debug info? HOT 3
- ICE when type checking HOT 3
- Passing pointer to value of type alias with `impl Trait` through function breaks this type HOT 4
- `std::fs::rename` sometimes fails on Windows due to missing `FILE_RENAME_POSIX_SEMANTICS` HOT 2
- make compiletest aware whether compiler was built with debug assertions
- ICE: unexpected resolution: Def(Trait, DefId(0:5 ~ hello[3c53]::main::Self))
- rustdoc: support RTN once its syntax is somewhat finalized
- STATUS_ENTRYPOINT_NOT_FOUND error with x86_64-pc-windows-gnu on Windows Server 2019 in GitHub action HOT 15
- Unexpected type for constructor `Struct` HOT 7
- `-Zprint-llvm-passes` lies on recent rustc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.