Skip to content
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

stripping binaries installed by rustup results in "Illegal instruction" error message #595

Open
sa2ajj opened this issue Jul 19, 2016 · 5 comments
Labels
O-linux Linux related

Comments

@sa2ajj
Copy link

sa2ajj commented Jul 19, 2016

I just installed rustup on my machine using the curl magic (Debian/testing, x86_64).

After installation I checked the content of the ~/.cargo/bin directory, e.g.:

$ file ~/.cargo/bin/cargo
~/.cargo/bin/cargo: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.9, not stripped

and cargo works just fine:

$ cargo 
Rust's package manager

Usage:
    cargo <command> [<args>...]
    cargo [options]

Options:
    -h, --help          Display this message
    -V, --version       Print version info and exit
    --list              List installed commands
    --explain CODE      Run `rustc --explain CODE`
    -v, --verbose       Use verbose output
    -q, --quiet         No output printed to stdout
    --color WHEN        Coloring: auto, always, never

Some common cargo commands are:
    build       Compile the current project
    clean       Remove the target directory
    doc         Build this project's and its dependencies' documentation
    new         Create a new cargo project
    init        Create a new cargo project in an existing directory
    run         Build and execute src/main.rs
    test        Run the tests
    bench       Run the benchmarks
    update      Update dependencies listed in Cargo.lock
    search      Search registry for crates
    publish     Package and upload this project to the registry
    install     Install a Rust binary

See 'cargo help <command>' for more information on a specific command.

However if I strip the binary

$ strip ~/.cargo/bin/cargo
$ file ~/.cargo/bin/cargo
~/.cargo/bin/cargo: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.9, stripped

I can't run it any more:

$ cargo
Illegal instruction
$ echo $?
132
@brson
Copy link
Contributor

brson commented Jul 19, 2016

I can reproduce.

@sa2ajj
Copy link
Author

sa2ajj commented Jul 21, 2016

As a side note, I tried locally to build a simple binary:

cargo new --bin check
cd check
cargo build
cargo build --release

both binaries run successfully without and with stripping (for some reason, even release binary is not stripped)

@brson
Copy link
Contributor

brson commented Jul 26, 2016

Likewise, when I build rustup locally and then strip it it works just fine.

@Diggsey Diggsey added this to Testing & infrastructure in Issue Categorisation May 4, 2017
@Diggsey Diggsey moved this from Testing to Build & Infrastructure in Issue Categorisation May 4, 2017
@kinnison
Copy link
Contributor

This is fascinating (I'm issue-spelunking) -- is this reproducible with modern releases of rustup?

@workingjubilee
Copy link
Contributor

@rustbot label: +O-linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-linux Linux related
Projects
Development

No branches or pull requests

5 participants