Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cargo run get "Segmetation fault" on Debian10 #8110

Closed
zoujieorg opened this issue Apr 15, 2020 · 4 comments
Closed

cargo run get "Segmetation fault" on Debian10 #8110

zoujieorg opened this issue Apr 15, 2020 · 4 comments
Labels
C-bug Category: bug

Comments

@zoujieorg
Copy link

  1. my operating system is debian10
    $ cat /etc/debian_version
    10.3
    $ uname -a
    Linux i5debain 4.19.0-8-amd64 feat(layout) www.rust-lang.org#1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux

  2. cargo version
    i5debain:projects/issue/something $ cargo --version
    cargo 1.42.0 (8633429 2020-01-31)

  3. cargo run get "Segmentaion fault"
    i5debain:projects $ mkdir issue
    i5debain:projects $ cd issue/
    i5debain:projects/issue $ ls
    i5debain:projects/issue $ cargo new something
    Created binary (application) something package
    i5debain:projects/issue $ cd something/
    i5debain:projects/issue/something$ cargo run
    Compiling something v0.1.0 (/home/zoujie/projects/issue/something)
    Finished dev [unoptimized + debuginfo] target(s) in 0.20s
    Running target/debug/something
    Segmentation fault

  4. rustc works ok
    i5debain:projects/issue/something $ rustc src/main.rs
    i5debain:projects/issue/something $ ./main
    Hello, world!

Steps

Possible Solution(s)

Notes

Output of cargo version:

@zoujieorg zoujieorg added the C-bug Category: bug label Apr 15, 2020
@ehuss
Copy link
Contributor

ehuss commented Apr 15, 2020

Can you use a debugger (like gdb) to figure out where it is having problems? Like enable core dumps and check where it crashed.

@zoujieorg
Copy link
Author

fn main() {
println!("Hello, world!");
}

Reading symbols from ./something/target/debug/something...done.
(gdb) b 2
Breakpoint 1 at 0x9: file src/main.rs, line 2.
(gdb) r
Starting program: /home/zoujie/projects/issue/something/target/debug/something
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000001 in ?? ()
(gdb)

@zoujieorg
Copy link
Author

(gdb) bt
#0 0x0000000000000001 in ?? ()
#1 0x00007fffffffe994 in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb)

@zoujieorg
Copy link
Author

with someone's help,I figure out .
Because I had add follow two line to my ~/.cargo/config
#[target.'cfg(target_os = "linux")']
#rustflags = ["-C", "link-arg=-nostartfiles"]
so binary can't find main enterpoint.

Thanks a lot.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants