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

Cross-compile for Raspberry Pi Zero W produces segmentation fault #391

Closed
netzdoktor opened this issue Mar 11, 2020 · 7 comments · Fixed by #392
Closed

Cross-compile for Raspberry Pi Zero W produces segmentation fault #391

netzdoktor opened this issue Mar 11, 2020 · 7 comments · Fixed by #392

Comments

@netzdoktor
Copy link

I have the minimal Rust hello world example and use cross to compile it for arm-unknown-linux-gnueabihf:

cross build --release --target=arm-unknown-linux-gnueabihf

When I deploy the file to the Pi Zero W, it produces a segmentation fault.

I have a working cross-compilation setup using this other toolchain repo but I would really love to use cross instead. What I read there was that GCC versions before GCC8 would produce bad binaries for the Raspi. This is also confirmed by that fact that I tried various other toolchains, but only few worked.

Could we maybe update the related Dockerfile accordingly and use a newer GCC? I saw that the linaro repo unfortunately does not provide it yet but instead they are now hosted by ARM themselves.

I would be happy to create a pull-request for this, but need a bit of guidance to make it fit into the overall cross project.

bors bot added a commit that referenced this issue Mar 12, 2020
392: Update `arm-unknown-linux-gnueabihf`. r=adamgreig a=reitermarkus

Fixes #391.

393: Update CMake to 3.16.5. r=adamgreig a=reitermarkus



394: Fix CI for `i686-apple-darwin`. r=adamgreig a=reitermarkus



Co-authored-by: Markus Reiter <me@reitermark.us>
bors bot added a commit that referenced this issue Mar 12, 2020
392: Update `arm-unknown-linux-gnueabihf`. r=adamgreig a=reitermarkus

Fixes #391.

Co-authored-by: Markus Reiter <me@reitermark.us>
@bors bors bot closed this as completed in bcdb3d3 Apr 16, 2020
@ghost
Copy link

ghost commented Apr 23, 2020

What is the process to be able to make use of this update?

I'm trying to compile for Raspberry Pi and also getting a segmentation fault.

thanks

@netzdoktor
Copy link
Author

For some reason, cross by default uses the tag 0.2.0 and not latest. #392 only led to an update of the latest Docker image.

Try adding the following Cross.toml file to force it to use the latest version (and consider doing a manual docker pull for the image if the problem persists):

[target.arm-unknown-linux-gnueabihf]
image = "rustembedded/cross:arm-unknown-linux-gnueabihf"

@ghost
Copy link

ghost commented Apr 23, 2020

Hello thanks for your reply where should I place the Cross.toml file?

Regarding the tag, will this be fixed in a future release?

thanks

@netzdoktor
Copy link
Author

Hello thanks for your reply where should I place the Cross.toml file?

At the same level as your Cargo.toml. See README.

@hombit
Copy link

hombit commented Apr 26, 2020

[target.arm-unknown-linux-gnueabihf]
image = "rustembedded/cross:arm-unknown-linux-gnueabihf"

@Darneas Somehow cross ignores this and continue to uses rustembedded/cross:arm-unknown-linux-gnueabihf-0.2.0 image

@netzdoktor
Copy link
Author

The Cross.toml should contain the two lines. The file should be at the same level as the Cargo.toml.

@talksik
Copy link

talksik commented Jun 8, 2023

for newer folks here, I was able to use arm-unknown-linux-gnueabihf as the target instead of armv7-unknown-linux-gnueabihf. README for this repo has a table of available targets. Turns out the pi zero has armv6 so armv7 doesn't work.

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

Successfully merging a pull request may close this issue.

3 participants