ShadowsocksX-NG icon indicating copy to clipboard operation
ShadowsocksX-NG copied to clipboard

Binary for arm architecture macOS

Open yikerman opened this issue 5 years ago • 28 comments

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.

yikerman avatar Jul 14 '20 09:07 yikerman

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

XIAZY avatar Dec 14 '20 11:12 XIAZY

@XIAZY How about embed both x86 and arm binary?

yikerman avatar Dec 14 '20 12:12 yikerman

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

XIAZY avatar Dec 14 '20 12:12 XIAZY

@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.

yikerman avatar Dec 14 '20 12:12 yikerman

@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

XIAZY avatar Dec 14 '20 12:12 XIAZY

@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.

yikerman avatar Dec 14 '20 12:12 yikerman

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

XIAZY avatar Dec 14 '20 12:12 XIAZY

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

yikerman avatar Dec 14 '20 12:12 yikerman

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 avatar Dec 14 '20 14:12 XIAZY

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.

XIAZY avatar Dec 14 '20 14:12 XIAZY

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

yikerman avatar Jan 17 '21 08:01 yikerman

@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

XIAZY avatar Jan 20 '21 03:01 XIAZY

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

yikerman avatar Jan 22 '21 11:01 yikerman

@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 avatar Jan 29 '21 10:01 yikerman

OK. Now here's my solution.

yikerman avatar Jan 30 '21 14:01 yikerman

Hi, do you have any updates on this ticket?

occamrazor1492 avatar Apr 10 '21 06:04 occamrazor1492

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.

XIAZY avatar Apr 10 '21 15:04 XIAZY

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!

occamrazor1492 avatar Apr 11 '21 02:04 occamrazor1492

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.

XIAZY avatar Apr 11 '21 02:04 XIAZY

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.

occamrazor1492 avatar Apr 11 '21 02:04 occamrazor1492

@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.

yikerman avatar Apr 11 '21 08:04 yikerman

@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.

occamrazor1492 avatar Apr 13 '21 17:04 occamrazor1492

@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.

yikerman avatar Apr 14 '21 07:04 yikerman

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

tiejunhu avatar Apr 20 '21 02:04 tiejunhu

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

@tiejunhu Do it yourself :-P

It’s pretty simple.

yikerman avatar Apr 20 '21 14:04 yikerman

@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

Alfxjx avatar Apr 24 '21 13:04 Alfxjx

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.

XIAZY avatar Apr 24 '21 13:04 XIAZY

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

yikerman avatar Apr 27 '21 12:04 yikerman