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

Add support/binary for ARM #337

Closed
thomasmerz opened this issue Dec 2, 2023 · 13 comments
Closed

Add support/binary for ARM #337

thomasmerz opened this issue Dec 2, 2023 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@thomasmerz
Copy link

I have some cloudservers/VPS running on ARM CPUs, so bandwhich in precompiled version for x86_64 don't run there:

[🇩🇪 -fsn] ✔ ~ [master|✔]
13:05 # bin/bandwhich
-bash: bin/bandwhich: cannot execute binary file: Exec format error

Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  2
  On-line CPU(s) list:   0,1
Vendor ID:               ARM
  Model name:            Neoverse-N1

Because I don't want to install compilers and stuff on my cloudserver(s) could you please be so kind and add an precompiled version for ARM? Thanks a lot 😘

@sigmaSd sigmaSd self-assigned this Dec 2, 2023
@sigmaSd
Copy link
Collaborator

sigmaSd commented Dec 2, 2023

I used cargo-zigbuild to crosscompile to arm and it worked fine before, ripgrep seems to use qemu + cargo cross for this.

Any preference @cyqsimon ?

@sigmaSd
Copy link
Collaborator

sigmaSd commented Dec 2, 2023

Sharkdp is also using cargo cross for his projects, so probably that's what we should do.

@sigmaSd
Copy link
Collaborator

sigmaSd commented Dec 2, 2023

But I see that ripgrep and bat for example both don't compile arm mac from ci , maybe it's a limitation of cross. (ripgrep provides locally built binaries)

cargo-zigbuild can cross compile to mac arm

@thomasmerz
Copy link
Author

I'm not so deep in processor architecture, but my VPS is "based on Ampere® Altra® processors" (Hetzner.de) - and I'm not sure what ARM-Macs are based on…

@sigmaSd
Copy link
Collaborator

sigmaSd commented Dec 3, 2023

I just menitoned macos arm because if we're going to add more architectures, we might as well add it , since its a popular one (mac m1 m2 etc are arm)

Can you confirm, that your system is just aarch64-linux ? you can compile a hello world binary and compile it to on another pc like this

rustup target add aarch64-unknown-linux-musl
cargo b --target aarch64-unknown-linux-musl

@cyqsimon
Copy link
Collaborator

cyqsimon commented Dec 4, 2023

Any preference @cyqsimon ?

Nah not really. Anything that works and is reasonably maintainable floats my boat.

I was looking at ouch yesterday and they seem to have a working cross-compile setup too. FYR.

@thomasmerz
Copy link
Author

I just menitoned macos arm because if we're going to add more architectures, we might as well add it , since its a popular one (mac m1 m2 etc are arm)

Can you confirm, that your system is just aarch64-linux ? you can compile a hello world binary and compile it to on another pc like this

rustup target add aarch64-unknown-linux-musl
cargo b --target aarch64-unknown-linux-musl

It is just aarch64 as I ordered it at Hetzner:

Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  2
  On-line CPU(s) list:   0,1
Vendor ID:               ARM
  Model name:            Neoverse-N1

@sigmaSd sigmaSd added the enhancement New feature or request label Dec 9, 2023
@thomasmerz
Copy link
Author

@sigmaSd do you have any news regarding a precompiled arm-version yet? Working on it? Thinking about it? Dismissing it?

@sigmaSd
Copy link
Collaborator

sigmaSd commented Jan 30, 2024

Unfortunately I haven't looked at this yet, but I saw @cyqsimon refactored ouch repo GitHub action, maybe its easy to copy the relèvent parts

It won't handle mac os arm binaries, but we can leave that until someone need it, arm Linux is a good start ( For building mac arm the only way for now I know of is using cargo zig build)

@thomasmerz
Copy link
Author

I agree that arm Linux would be a great start 👍🏼

@flxo
Copy link
Contributor

flxo commented Apr 2, 2024

Hello. With #384 merged the groundwork is done for more cross builds. @cyqsimon mentioned that they would like to refactor the CI layout but with the current setup builds for arm(s) is trivial if someone want's to catch up.
draft
result

@sigmaSd
Copy link
Collaborator

sigmaSd commented Apr 4, 2024

Cool, also I just noticed that github action now supply free m1 runner (name macos-14) which can be used to compile natively for macos arm

@cyqsimon
Copy link
Collaborator

Not sure why #401 didn't close this. Closing manually.

Cross compilation instructions are now in README, and prebuilt binaries should be available starting from next point release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants