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

Get "-bash: ./test: No such file or directory" error on BeagleBone #54

Open
psiphi75 opened this issue Dec 1, 2020 · 3 comments
Open

Comments

@psiphi75
Copy link

psiphi75 commented Dec 1, 2020

When I use the below configuration and cross compile to ARMv7 I get the following error message on the BeagleBone:

debian@beaglebone:~$ ./test 
-bash: ./test: No such file or directory

When I use v0.2.2 of linux-embedded-hal or earlier I do not get this error. If I remove extern crate linux_embedded_hal as hal; from the code I do not get the error.

Any ideas?

The code

src/main.rs

extern crate linux_embedded_hal as hal;

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

.cargo/config

[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-gnueabihf-gcc"
rustflags = ["-Clink-args=-Xlinker -rpath=/usr/lib/arm-linux-gnueabihf"]

Cargo.toml

[package]
name = "test"
version = "0.1.0"
edition = "2018"

[dependencies]
linux-embedded-hal = "0.4.0-alpha.0"

To compile I use:

cargo build --target=armv7-unknown-linux-musleabihf --release
@caemor
Copy link
Contributor

caemor commented Dec 1, 2020

Could you please give us the output from readelf --all ./test | grep interpreter (from https://stackoverflow.com/questions/35071872/bash-no-such-file-or-directory). It looks like there is a problem with your linker 🤔

@psiphi75
Copy link
Author

psiphi75 commented Dec 2, 2020

Yes, that's it thank you. But only the first part of my problem. The command readelf --all ./test | grep interpreter gave:

      [Requesting program interpreter: /usr/lib/ld.so.1]

So I changed my target to armv7-unknown-linux-gnuabihf and this resulted in:

      [Requesting program interpreter: /lib/ld-linux-armhf.so.3]

Now I'm stuck with the following message on my BeagleBone:

./test: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.32' not found (required by ./test)

I'm going remain with version 0.2.2 for now. Thanks.

@ryankurte
Copy link
Contributor

ryankurte commented Sep 26, 2021

in your initial .cargo/config it appears you're trying to build a rust musl target using a gnu linker, you need to use one or the other which should look like:

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-musleabihf-gcc"

to get the musl cross tooling you can either compile it yourself, find a pre-compiled package, or use cross which provides docker containers with the required tooling pre-installed.

./test: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.32' not found (required by ./test)

gnu targets require libc for dynamic linking at runtime, it looks like you don't have this installed on your beaglebone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants