-
Notifications
You must be signed in to change notification settings - Fork 359
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
Can't target Raspberry Pi 1 and Pi Zero #426
Comments
Yes, the compiler downloaded from developer.arm.com in the Dockerfile (https://github.com/rust-embedded/cross/blob/master/docker/Dockerfile.arm-unknown-linux-gnueabihf#L14) is built with Here is a possible solution: https://github.com/Pro/raspi-toolchain |
I just confirmed that the above toolchain works for Pi Zero. And the official Raspberry toolchain works, too. Here is a description: japaric/rust-cross#42 |
@schlamar Thanks for the response and I'm aware of those other options. Problem is they aren't suitable for complex projects that need to install native arm packages into the docker image; something that this project manages quite nicely. Case in point my current Rust project builds fine using this project for RPi 2 but cannot link (due to dependency issues) using this alternate approach for RPi Zero. So, I'll continue to pursue support here and/or cobble together a Dockerfile that merges the necessary ARMv6 toolchain support. |
Yes, of course :-) The cross maintainers should integrate one of these solutions (or another working alternative for ARMv6) into their arm-unknown-linux-gnueabihf Dockerfile. But other persons who stumble about this issue by Google (like me two days ago) will be thankful for a workaround I guess ;-) |
PRs are welcome. 😉 |
hey @BrianHoldsworth did you find a solution? I think I'm having a similar problem. I'm building a project for the Raspberry Pi Zero and failing to link dependencies even though they are installed. |
@tmigone I punted for now, since I am just in prototype and can target an RPi2 |
Hi, I've managed to make it work using a custom docker image: https://github.com/zenria/rbp1-cross-docker |
@zenria I can see how that should work. Unfortunately, something about this Dockerfile seems to revert to a different / older glibc for ARM, which breaks linking for me. |
Which distro do you run on your Pi? I'm building executables with this docker image that runs successfully on Raspbian 9.11:
|
@zenria I am targeting Arch Linux ARM, a rolling distro, on RPi2 (works fine linking and running with The main difference between your docker and mine is I have added:
This because I use Rust code that is dependent on |
I was able to successfully compile for the Pi Zero with this patch that utilizes abhitronix pre-built tool chains. It breaks the toolchain versioning, but GCC 8, 9, and 10 versions are available. diff --git a/docker/Dockerfile.arm-unknown-linux-gnueabihf b/docker/Dockerfile.arm-unknown-linux-gnueabihf COPY common.sh lib.sh / COPY cmake.sh / RUN mkdir /usr/arm-linux-gnueabihf \
ENV PATH /usr/arm-linux-gnueabihf/bin:$PATH diff --git a/docker/common.sh b/docker/common.sh
|
Rust's official Platform Support says that these targets should be ARMv6, so I would consider this a bug, since these images should target ARMv6 processors.
The current toolset uses ARMv7-A. |
Change the `arm-unknown-linux-gnueabihf` to build a toolchain using crosstool-ng, so that we build a toolchain using ARMv6 support, rather than ARMv7. This also adds support for crosstool-ng-based images, which are configured from template config files so that we can modify the GCC, glibc, and Linux versions. These are configured by running `crosstool-ng/configure.sh`, which scans that directory for all `*.config.in` files, and configures them to `docker/crosstool-config`. The script can have the toolchain versions modified via `GCC_VERSION`, `GLIBC_VERSION`, and `LINUX_VERSION`. Closes cross-rs#426.
Change the `arm-unknown-linux-gnueabihf` to build a toolchain using crosstool-ng, so that we build a toolchain using ARMv6 support, rather than ARMv7. This also adds support for crosstool-ng-based images, which are configured from template config files so that we can modify the GCC, glibc, and Linux versions. These are configured by running `crosstool-ng/configure.sh`, which scans that directory for all `*.config.in` files, and configures them to `docker/crosstool-config`. The script can have the toolchain versions modified via `GCC_VERSION`, `GLIBC_VERSION`, and `LINUX_VERSION`. Closes cross-rs#426.
Change the `arm-unknown-linux-gnueabihf` to build a toolchain using crosstool-ng, so that we build a toolchain using ARMv6 support, rather than ARMv7. This also adds support for crosstool-ng-based images, which are configured from template config files so that we can modify the GCC, glibc, and Linux versions. These are configured by running `crosstool-ng/configure.sh`, which scans that directory for all `*.config.in` files, and configures them to `docker/crosstool-config`. The script can have the toolchain versions modified via `GCC_VERSION`, `GLIBC_VERSION`, and `LINUX_VERSION`. Closes cross-rs#426.
734: Fix ARMv6 HF image to correctly build for ARMv6 architecture. r=Emilgardis a=Alexhuszagh Change the `arm-unknown-linux-gnueabihf` to build a toolchain using crosstool-ng, so that we build a toolchain using ARMv6 support, rather than ARMv7. This also adds support for crosstool-ng-based images, which are configured from template config files so that we can modify the GCC, glibc, and Linux versions. These are configured by running `crosstool-ng/configure.sh`, which scans that directory for all `*.config.in` files, and configures them to `docker/crosstool-config`. The script can have the toolchain versions modified via `GCC_VERSION`, `GLIBC_VERSION`, and `LINUX_VERSION`. Closes #426. 735: add issue templates r=Emilgardis a=Emilgardis resolves #732 Co-authored-by: Alex Huszagh <ahuszagh@gmail.com> Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
734: Fix ARMv6 HF image to correctly build for ARMv6 architecture. r=Emilgardis a=Alexhuszagh Change the `arm-unknown-linux-gnueabihf` to build a toolchain using crosstool-ng, so that we build a toolchain using ARMv6 support, rather than ARMv7. This also adds support for crosstool-ng-based images, which are configured from template config files so that we can modify the GCC, glibc, and Linux versions. These are configured by running `crosstool-ng/configure.sh`, which scans that directory for all `*.config.in` files, and configures them to `docker/crosstool-config`. The script can have the toolchain versions modified via `GCC_VERSION`, `GLIBC_VERSION`, and `LINUX_VERSION`. Closes #426. 735: add issue templates r=Emilgardis a=Emilgardis resolves #732 Co-authored-by: Alex Huszagh <ahuszagh@gmail.com> Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
734: Fix ARMv6 HF image to correctly build for ARMv6 architecture. r=Emilgardis a=Alexhuszagh Change the `arm-unknown-linux-gnueabihf` to build a toolchain using crosstool-ng, so that we build a toolchain using ARMv6 support, rather than ARMv7. This also adds support for crosstool-ng-based images, which are configured from template config files so that we can modify the GCC, glibc, and Linux versions. These are configured by running `crosstool-ng/configure.sh`, which scans that directory for all `*.config.in` files, and configures them to `docker/crosstool-config`. The script can have the toolchain versions modified via `GCC_VERSION`, `GLIBC_VERSION`, and `LINUX_VERSION`. Closes #426. 735: add issue templates r=Emilgardis a=Emilgardis resolves #732 Co-authored-by: Alex Huszagh <ahuszagh@gmail.com> Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
Use `readelf -A` on generated binaries to read the target architecture information and output the data as JSON, simplifying verifying that new targets produce code for the desired architecture. Closes cross-rs#821. Related to cross-rs#426.
Use `readelf -A` on generated binaries to read the target architecture information and output the data as JSON, simplifying verifying that new targets produce code for the desired architecture. Closes cross-rs#821. Related to cross-rs#426.
1018: Update deny list to all system packages for ARMv6 HF. r=Emilgardis a=Alexhuszagh Currently, when using `arm-unknown-linux-gnueabihf`, users frequently try to install packages for the `armhf` Debian architecture, objects which are compiled for ARMv7-A, and therefore are not compatibility with ARMv6 platforms such as the Raspberry Pi 0. This differs from the soft-float targets, where packages for the `armel` architecture are compiled for the ARMv5TE architecture, and therefore are compatible with ARMv5TE, ARMv6, and ARMv7 soft-float targets. Deny-listing all packages for the `armhf` architecture prevents issues such as in #1017, where the use of ARMv7 system packages are linked to the binary, so the resulting binary can no longer be executed on an ARMv6 platform. This is difficult to detect until the user attempts to use the generated objects (binaries, libraries) on native hardware. Also linked is #426. Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
This issue is related to #391 and #414
I am trying to build for the Pi Zero W using target=arm-unknown-linux-gnueabihf. I think that's the right target for RPi, but there is no way to distinguish between building for ARMv6 (RPi 1 and Zero) vs. ARMv7 (RPi 2). The resulting binary is ARMv7, which works on RPi2, but crashes with a segmentation fault on RPi Zero.
I add the following in my simple Rust project's
Cross.toml
file to avoid using the older "0.2" version docker image that was upgraded for #391AND I can confirm using
docker images
after runningcross build
that I'm not using the olderarm-unknown-linux-gnueabihf-0.2.0
It appears to me that
cross build
is creating an ARMv7 binary, and this causes the Seqmentation Fault on the Pi Zero, which is an ARMv6 CPU.The text was updated successfully, but these errors were encountered: