bandwhich icon indicating copy to clipboard operation
bandwhich copied to clipboard

Add support/binary for ARM

Open thomasmerz opened this issue 1 year ago • 10 comments

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 😘

thomasmerz avatar Dec 02 '23 12:12 thomasmerz

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 avatar Dec 02 '23 12:12 sigmaSd

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

sigmaSd avatar Dec 02 '23 12:12 sigmaSd

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

sigmaSd avatar Dec 02 '23 12:12 sigmaSd

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…

thomasmerz avatar Dec 02 '23 21:12 thomasmerz

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

sigmaSd avatar Dec 03 '23 06:12 sigmaSd

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.

cyqsimon avatar Dec 04 '23 03:12 cyqsimon

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

thomasmerz avatar Dec 04 '23 11:12 thomasmerz

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

thomasmerz avatar Jan 30 '24 16:01 thomasmerz

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)

sigmaSd avatar Jan 30 '24 17:01 sigmaSd

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

thomasmerz avatar Jan 30 '24 17:01 thomasmerz

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

flxo avatar Apr 02 '24 11:04 flxo

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

sigmaSd avatar Apr 04 '24 21:04 sigmaSd

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.

cyqsimon avatar Apr 30 '24 02:04 cyqsimon