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 compilation (Docker) to arm64 and arm/v7 #21

Closed
aaronleopold opened this issue Jun 21, 2022 · 6 comments
Closed

Cross compilation (Docker) to arm64 and arm/v7 #21

aaronleopold opened this issue Jun 21, 2022 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@aaronleopold
Copy link
Collaborator

Making this a real issue to hopefully get more visibility. I haven't quite figured out how to get cross-compilation (in Docker) working, an absolutely essential thing to get working so Stump can run on arm systems (e.g. rpi-4).

see https://github.com/aaronleopold/stump/tree/aleopold--arm64-can-sma

@aaronleopold aaronleopold added the help wanted Extra attention is needed label Jun 21, 2022
@aaronleopold
Copy link
Collaborator Author

same thing will need to be figured out for linux/arm/v7 too

@alxjpzmn
Copy link
Contributor

alxjpzmn commented Jun 22, 2022

Have you tried Cross? Any objections of adding it to the project? If not, I'll give it a go later today. Cross compilation to aarch64-unknown-linux-musl & aarch64-unknown-linux-gnu work for me (outside the container for now) using Cross & openssl = { version = "0.10.40", features = ["vendored"] }.

@aaronleopold
Copy link
Collaborator Author

I'm definitely open to trying it! Feel free to give it a go, I did add openssl for arm64 in the Cargo.toml but it'll have to be added for each other target.

@aaronleopold
Copy link
Collaborator Author

aaronleopold commented Jul 1, 2022

Reopening this as compilation is successful for both arm64 and arm/v7, however testing on actual arm devices fails. (stump | exec ./stump: no such file or directory) I spent quite some time trying to figure this out and haven't gotten it yet. At first I thought maybe the build wasn't actually being statically compiled, but enforcing that didn't work. I added binutils in the final stage for debugging and found this:

/app $ readelf -a stump | grep interpreter
      [Requesting program interpreter: /lib/ld-linux-aarch64.so.1]

/lib $ ls
apk                     libc.musl-aarch64.so.1  libz.so.1.2.12
firmware                libcrypto.so.1.1        mdev
ld-musl-aarch64.so.1    libssl.so.1.1           modules-load.d
libapk.so.3.12.0        libz.so.1               sysctl.d

Looks like it is trying to grab something that doesn't exist

Edit: creating a sym link seems to have fixed it! Tested in the already built image creating the link as root (ln -s /lib/ld-musl-aarch64.so.1 /lib/ld-linux-aarch64.so.1) and Stump launched 🎉 Will add to dockerfile and retest this week. Hopefully this can finally fully resolve this issue.

@aaronleopold aaronleopold reopened this Jul 1, 2022
@aaronleopold aaronleopold changed the title Cross compilation (Docker) to aarch64-unknown-linux-musl Cross compilation (Docker) to arm64 and arm/v7 Jul 1, 2022
@aaronleopold
Copy link
Collaborator Author

aaronleopold commented Jul 3, 2022

This line

RUN ln -s /lib/ld-musl-aarch64.so.1 /lib/ld-linux-aarch64.so.1; exit 0

fixes the docker image for arm64, now I will just have to fix arm/v7 and can close this issue.

@aaronleopold
Copy link
Collaborator Author

Closing for #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants