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 workflow #5

Open
ssssam opened this issue Nov 15, 2021 · 1 comment
Open

Cross compile workflow #5

ssssam opened this issue Nov 15, 2021 · 1 comment

Comments

@ssssam
Copy link
Owner

ssssam commented Nov 15, 2021

I want to build for ARM devices, initially targetting Organelle 1.

Ideal approach might be to use rust-embedded/cross tool, which uses prebuilt Ubuntu containers to run Rust toolchain.

As of cross 0.2.1 (15/11/2021), the default command cross build --target armv7-unknown-linux-musleabihf fails to build 'alsa-sys' crate because the sysroot doesn't contain libasound headers. Related issues:

The workaround is to use custom Docker images as a build base instead of the default ones, so we might build our own image and add this in Cross.toml:

[target.aarch64-unknown-linux-gnu]
image = "my/image:tag"
@ssssam
Copy link
Owner Author

ssssam commented Nov 15, 2021

I tried using a custom Docker image.

> cat docker/Dockerfile.arm 
FROM rustembedded/cross:armv7-unknown-linux-gnueabihf-0.2.1

RUN dpkg --add-architecture armhf && \
    apt-get update && \
    apt-get install --assume-yes libasound2-dev:armhf

ENV PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig

> cat Cross.toml 
[target.armv7-unknown-linux-gnueabihf]
image = "boucle/build:latest"

Build the image:

podman build -f ./docker/Dockerfile.arm -t boucle/build

This results in a successful shared build of boucle_organelle binary, linked against GLIBC 2.23, which actually seems to work on the Organelle OS which uses 2.22. Maybe this is good enough for now.

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

1 participant