shadowsocks / ShadowsocksX-NG

Next Generation of ShadowsocksX
GNU General Public License v3.0
32.48k stars 7.95k forks source link

Binary for arm architecture macOS #1332

Open yikerman opened 4 years ago

yikerman commented 4 years ago

Since Apple has released an arm architecture macOS, ShadowsocksX-NG should also release a binary for those users. (Even though x86 apps are still supported on those machines.)

Problems

The repo contains a x86 binary of shadowsocks-libev. It’s even copied from HomeBrew a long time ago!

Possible solutions

  1. Build shadowsocks from source. (RECOMMEND, by embedding a build script.)
  2. Include another arm binary.
XIAZY commented 3 years ago

Building shadowsocks-libev from source is probably not feasible, as the readme says

It's hard to maintain the original implementation as there is too much unused code in it. It also embeds the ss-local source code. It's crazy to maintain dependencies of ss-local. So it's hard to update the ss-local version.

I am not sure if maintainers have a plan to add universal binary support. I am currently experimenting options

yikerman commented 3 years ago

@XIAZY How about embed both x86 and arm binary?

XIAZY commented 3 years ago

@xiaoyu2006 That's what I'm looking into. According to this article, it's not hard to compile a fat binary.

yikerman commented 3 years ago

@XIAZY Also we can start a sort of web service to let the client automatically grab the latest compiled binary.

As for the fat binary, I hadn't compiled an arm port of ss-libev yet.

XIAZY commented 3 years ago

@xiaoyu2006 I've had luck compiling shadowsocks-libev, but had some linking problems embedding them to the this project. I am experimenting options but unfortunately I'm not an expert on Apple's toolchain

yikerman commented 3 years ago

@XIAZY How about following the CI file from it? https://github.com/shadowsocks/shadowsocks-libev/blob/master/.travis.yml

We just need to follow it on both architectures and merge them.

XIAZY commented 3 years ago

@xiaoyu2006 Thanks for reminding me - I didn't know there was a CI system. Will look into it

yikerman commented 3 years ago

@XIAZY THe question is the CI process Homebrewed everything, while the deps' binary may be unavailable in arm64.

XIAZY commented 3 years ago

I tried replacing my own ss-local binary and dynamic libraries with the original one, unfortunately it doesn't work. I can execute the binary outside ~/Library/Application Support/ShadowsocksX-NG/ss-local-lastest, but got a Killed: 9 executing it inside that folder. I am not an expert in Mac App development so maybe someone can takeover the work or kindly provide some hints.

XIAZY commented 3 years ago

Oh nvm. After a long debugging it turns out to be a long-standing wrinkle of macOS that caches code sign of mach-o files. My build works pretty well and should be able to submit a PR soon.

yikerman commented 3 years ago

@XIAZY It turns out that the Rust port of shadowsocks iOS the future (and however MUCH MUCH more convince to build.) So...

XIAZY commented 3 years ago

@XIAZY It turns out that the Rust port of shadowsocks iOS the future (and however MUCH MUCH more convince to build.) So...

Actually, I don't know. Ive been running my build for a while and I haven't observed any problem

yikerman commented 3 years ago

@XIAZY I just think we should follow the new port.

yikerman commented 3 years ago

@XIAZY

Now I finally worked out an automation workflow for building sslocal as a universal binary. Repo @ https://github.com/xiaoyu2006/ss-buildbot.

My idea is to use it as an OTA service, write code to let the client fetch and install the latest built sslocal, as how GFWList is updated.

yikerman commented 3 years ago

OK. Now here's my solution.

occamrazor1492 commented 3 years ago

Hi, do you have any updates on this ticket?

XIAZY commented 3 years ago

Hi, do you have any updates on this ticket?

We are all waiting for the maintainer to make a decision. If you don't mind, maybe you can grab one of the PR and compile your own binary.

occamrazor1492 commented 3 years ago

Hi, do you have any updates on this ticket?

We are all waiting for the maintainer to make a decision. If you don't mind, maybe you can grab one of the PR and compile your own binary.

Yeah, I don't mind totally, let me get it straight. So you mean I could build a binary for M1? Do you mind pointing me the doc for doing that? Thanks a lot!

XIAZY commented 3 years ago

Hi, do you have any updates on this ticket?

We are all waiting for the maintainer to make a decision. If you don't mind, maybe you can grab one of the PR and compile your own binary.

Yeah, I don't mind totally, let me get it straight. So you mean I could build a binary for M1? Do you mind pointing me the doc for doing that? Thanks a lot!

If you are on an M1 Mac and have Xcode installed, you should be able to build a binary package without any configuration.

occamrazor1492 commented 3 years ago

Hi, do you have any updates on this ticket?

We are all waiting for the maintainer to make a decision. If you don't mind, maybe you can grab one of the PR and compile your own binary.

Yeah, I don't mind totally, let me get it straight. So you mean I could build a binary for M1? Do you mind pointing me the doc for doing that? Thanks a lot!

If you are on an M1 Mac and have Xcode installed, you should be able to build a binary package without any configuration.

Thanks, I would give it a shot.

yikerman commented 3 years ago

@occamrazor1492

If you are on an M1 Mac and have Xcode installed, you should be able to build a binary package without any configuration.

The default Debug configuration follows your system architecture, while Release builds a fat binary with x86_64 and aarch64.

occamrazor1492 commented 3 years ago

@occamrazor1492

If you are on an M1 Mac and have Xcode installed, you should be able to build a binary package without any configuration.

The default Debug configuration follows your system architecture, while Release builds a fat binary with x86_64 and aarch64.

Have you guys got a working build? I could get a build on M1 but seems the build doesn't work on M1. I am using ss with the v2ray plugin, it doesn't connect me to the world, still, trap inside the wall.

yikerman commented 3 years ago

@occamrazor1492

If you are on an M1 Mac and have Xcode installed, you should be able to build a binary package without any configuration.

The default Debug configuration follows your system architecture, while Release builds a fat binary with x86_64 and aarch64.

Have you guys got a working build? I could get a build on M1 but seems the build doesn't work on M1. I am using ss with the v2ray plugin, it doesn't connect me to the world, still, trap inside the wall.

Which PR are you using? Upload your sslocal.log for further diagnosis.

tiejunhu commented 3 years ago

Could anyone kindly release a download link of the arm64 build ?

yikerman commented 3 years ago

Could anyone kindly release a download link of the arm64 build ?

@tiejunhu Do it yourself :-P

It’s pretty simple.

Alfxjx commented 3 years ago

@XIAZY Do you mean if I want to have a release for Apple Silicon , all I need to do is run the script in .travis.yaml ? Don't know much about Xcode

XIAZY commented 3 years ago

I think you should be able to just open the project in Xcode and compile it, no Travis needed

On Apr 24, 2021, at 9:35 AM, Xu Jianxiang @.***> wrote:



@XIAZYhttps://github.com/XIAZY Do you mean if I want to have a release for Apple Silicon , all I need to do is run the script in .travis.yaml ? Don't know much about Xcode

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/shadowsocks/ShadowsocksX-NG/issues/1332#issuecomment-826094083, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACCU6X3JGQNSMUOSH4I2DFDTKLCJ3ANCNFSM4OZLIMMA.

yikerman commented 3 years ago

I think you should be able to just open the project in Xcode and compile it, no Travis needed On Apr 24, 2021, at 9:35 AM, Xu Jianxiang @.***> wrote:  @XIAZYhttps://github.com/XIAZY Do you mean if I want to have a release for Apple Silicon , all I need to do is run the script in .travis.yaml ? Don't know much about Xcode — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<#1332 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACCU6X3JGQNSMUOSH4I2DFDTKLCJ3ANCNFSM4OZLIMMA.

Yup. Remember to open the workspace project with Xcode toolchain installed. No further configuration needed. @Alfxjx