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 for Arm #69

Closed
zytanic opened this issue Jan 5, 2022 · 18 comments
Closed

Add support for Arm #69

zytanic opened this issue Jan 5, 2022 · 18 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@zytanic
Copy link

zytanic commented Jan 5, 2022

No description provided.

@rapiz1
Copy link
Owner

rapiz1 commented Jan 6, 2022

aarch64-unknown-linux-musl stands for ARM64 Linux with MUSL, which is already supported. Is it what you need?

@rapiz1 rapiz1 added enhancement New feature or request help wanted Extra attention is needed labels Jan 6, 2022
@phyng
Copy link

phyng commented Jan 6, 2022

@rapiz1 Maybe he needs Apple M1(arm64) version just like me, I will try to compile it by myself late.

@rapiz1
Copy link
Owner

rapiz1 commented Jan 6, 2022

@phyng That's not easy to set up :) Since Github Action doesn't provide M1 runner, we have to do cross build. CI uses cross to cross build and M1 is not supported for now.

@jasonlearst
Copy link

The aarch64-unknown-linux-musl does not work on my Pi Zero. I expect that the aarch64-unknown-linux-musl is compiled for ARMv7.

I am currently attempting to compile it on the Pi Zero to see if it will work.

pi@pizero:/tmp $ ./rathole 
-bash: ./rathole: cannot execute binary file: Exec format error

@rapiz1
Copy link
Owner

rapiz1 commented Jan 6, 2022

The aarch64-unknown-linux-musl does not work on my Pi Zero. I expect that the aarch64-unknown-linux-musl is compiled for ARMv7.

ARMv7 is actually 32bits :)

Anyway I'm glad to provide releases for more architectures.

@jasonlearst Can you checkout rustc Platform Support to pick ARM ones that you think will be very useful for you and other users? I don't know much about ARM and there are so many targets 😅

@zytanic
Copy link
Author

zytanic commented Jan 6, 2022

I tried to run it on my raspberry PI 3 and it doesnt work

@jasonlearst
Copy link

I did some reading and found that these targets are needed to support the current Raspberry Pis

  • arm-unknown-linux-gnueabihf
  • arm-unknown-linux-musleabihf
  • armv7-unknown-linux-gnueabihf
  • armv7-unknown-linux-musleabihf

Source: https://piers.rocks/docker/containers/raspberry/pi/rust/cross/compile/compilation/2018/12/16/rust-compilation-for-raspberry-pi.html

@rapiz1
Copy link
Owner

rapiz1 commented Jan 6, 2022

@jasonlearst Thank you very much! I will try to include these targets

@rapiz1
Copy link
Owner

rapiz1 commented Jan 6, 2022

I built some binaries in a ci test repo. Can you try this out? https://github.com/yssjglg/rathole/actions/runs/1661695534 @jasonlearst @zytanic

@phyng
Copy link

phyng commented Jan 6, 2022

@rapiz1
It can be compiled successfully on Apple M1, I have no problem 😄

➜  rathole git:(main) file target/release/rathole    
target/release/rathole: Mach-O 64-bit executable arm64

@zytanic
Copy link
Author

zytanic commented Jan 6, 2022

Works on the raspberry pi now

@rapiz1
Copy link
Owner

rapiz1 commented Jan 6, 2022

Works on the raspberry pi now

Glad to hear that :)

@jasonlearst
Copy link

Thanks for the new binaries!

Using rathole-armv7-unknown-linux-musleabihf.zip on my Pi 4 and rathole-arm-unknown-linux-musleabihf.zip on my Pi Zero I am able to create a working rathole connection.

@tonyho
Copy link

tonyho commented Jan 7, 2022

@rapiz1 The size of the armv7 version is about 2MB, this is too big for embedded devices. Any plan to reduce the size in following release?

@rapiz1
Copy link
Owner

rapiz1 commented Jan 7, 2022

Any plan to reduce the size in following release?

Currently binaries of some platforms(including arm) are not stripped. #71 tracks the cross-platform strip effort.

But you can always strip manually, if you have the arm toolchain. See strip. This may reduce the binary by ~1MiB.

And if that's not enough, you can build rathole without some features. See the build guide. If you want certain feature combinations to be build with each release, you can give some feedback under #70

@tonyho
Copy link

tonyho commented Jan 7, 2022

Any plan to reduce the size in following release?

Currently binaries of some platforms(including arm) are not stripped. #71 tracks the cross-platform strip effort.

But you can always strip manually, if you have the arm toolchain. See strip. This may reduce the binary by ~1MiB.

And if that's not enough, you can build rathole without some features. See the build guide. If you want certain feature combinations to be build with each release, you can give some feedback under #70

It has been stripped already for the armv7 elf (rathole-armv7-unknown-linux-musleabihf.zip):

file rathole
rathole: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, stripped

$ arm-linux-gnueabihf-strip -S rathole.armv7 
arm-linux-gnueabihf-strip: error: the input file 'rathole.armv7' has no sections


$ du -sh rathole
2.1M	rathole

@rapiz1
Copy link
Owner

rapiz1 commented Jan 7, 2022

@tonyho Oh. It has been already compressed by upx so the strip cannot find the sections that it needs to strip, while actually it can be stripped. You can checkout the strip status here to know if a binary is successfully stripped.

In this case, you need to build a binary by yourself, then run strip and upx :)

@rapiz1
Copy link
Owner

rapiz1 commented Jan 7, 2022

It seems like nobody requests for more ARM binaries of other different targets. Closed.

Feel free to open an issue if anyone has other questions.

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

No branches or pull requests

5 participants