facebook / dotslash

Simplified executable deployment
https://dotslash-cli.com
Apache License 2.0
535 stars 14 forks source link

Add aarch64 to ubuntu release #9

Closed hn8 closed 4 months ago

hn8 commented 4 months ago

Would you please consider adding aarch64 binary release for linux VM running on Apple Silicon without rosetta2? Thanks

bolinfest commented 4 months ago

If you build DotSlash from source on that Linux VM right now, does it work?

But yes, we should be able to provide ARM Ubuntu release builds pretty easily.

bolinfest commented 4 months ago

Hmm, this is going to be a bit harder than I thought since GitHub does not seem to provide these runners by default yet:

https://github.com/actions/runner-images/issues/2536

On my Ubuntu 20.04 machine, I tried updating Cargo.toml to include:

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

and did:

sudo apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross

but the build fails with:

          /usr/bin/ld: /home/mbolin/src/dotslash/target/aarch64-unknown-linux-gnu/debug/deps/dotslash-1106e55710a63aa1.11827l57e7qgx8lz.rcgu.o: error adding symbols: file in wrong format

Based on the articles I've found, my best guess is that something in the transitive deps of DotSlash has some build step that is outside of Cargo (so a build.rs) that is likely producing x86_64 artifacts instead of ARM64 ones, which don't link.

@dtolnay any suggestions?

bolinfest commented 4 months ago

Incidentally, this does not match anything:

find target/aarch64-unknown-linux-gnu/ -name \*.o | xargs -I {} file {} | grep -v ARM
dtolnay commented 4 months ago

This builds successfully for me from Ubuntu: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc cargo build --target aarch64-unknown-linux-gnu --release

bolinfest commented 4 months ago

Hmm, that works for me as well. I saw a comment somewhere that maybe I needed to update .cargo/config.toml instead of Cargo.toml?