cloudflare / cloudflared

Cloudflare Tunnel client (formerly Argo Tunnel)
https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide
Apache License 2.0
9.26k stars 820 forks source link

arm64 build for macOS #389

Closed kklem0 closed 3 months ago

kklem0 commented 3 years ago

Is there something stopping this project to release arm64 build for macOS?

kklem0 commented 3 years ago

Works well for me

commit 55bfcf1d2086550760db320ff340e646d9dae1eb (HEAD -> master)
Author: Clement Wong <git@clement.hk>
Date:   Sun Jun 6 14:40:39 2021 +0200

    macOS arm64

diff --git a/Makefile b/Makefile
index 16fdd9ba..777e0bc7 100644
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,8 @@ else ifeq ($(LOCAL_ARCH),i686)
     TARGET_ARCH ?= amd64
 else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 5),armv8)
     TARGET_ARCH ?= arm64
+else ifeq ($(LOCAL_ARCH),arm64)
+    TARGET_ARCH ?= arm64
 else ifeq ($(LOCAL_ARCH),aarch64)
     TARGET_ARCH ?= arm64
 else ifeq ($(shell echo $(LOCAL_ARCH) | head -c 4),armv)
diff --git a/go.mod b/go.mod
index 3122d039..ff028746 100644
--- a/go.mod
+++ b/go.mod
@@ -3,6 +3,7 @@ module github.com/cloudflare/cloudflared
 go 1.15

 require (
+       github.com/BurntSushi/go-sumtype v0.0.0-20190304192233-fcb4a6205bdc // indirect
        github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894 // indirect
        github.com/cloudflare/brotli-go v0.0.0-20191101163834-d34379f7ff93
        github.com/cloudflare/golibs v0.0.0-20170913112048-333127dbecfc
diff --git a/go.sum b/go.sum
index 6328b01e..6292e66d 100644
--- a/go.sum
+++ b/go.sum
@@ -59,6 +59,8 @@ github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQ
 github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
 github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88=
 github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
+github.com/BurntSushi/go-sumtype v0.0.0-20190304192233-fcb4a6205bdc h1:nvTP+jmloR0+J4YQur/rLRdLcGVEU4SquDgH+Bo7gBY=
+github.com/BurntSushi/go-sumtype v0.0.0-20190304192233-fcb4a6205bdc/go.mod h1:7yTWMMG2vOm4ABVciEt4EgNVP7fxwtcKIb/EuiLiKqY=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
@@ -668,6 +670,7 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
 golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
 golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
 golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
 golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -804,6 +807,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
 golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190221204921-83362c3779f5/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
 golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
 golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
@@ -848,6 +852,7 @@ golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roY
 golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
+golang.org/x/tools v0.0.0-20200825202427-b303f430e36d h1:W07d4xkoAUSNOkOzdzXCdFGxT7o2rW4q8M34tB2i//k=
 golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 95b99011..cd46a36c 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,3 +1,5 @@
+# github.com/BurntSushi/go-sumtype v0.0.0-20190304192233-fcb4a6205bdc
+## explicit
 # github.com/BurntSushi/toml v0.3.1
 github.com/BurntSushi/toml
 # github.com/beorn7/perks v1.0.1
mountainash commented 3 years ago

Still working for you? Is there a reason it's not raised as a PR?

kklem0 commented 3 years ago

Have been using it for the past few weeks and it works quite well. It's not a PR because I haven't looked into packaging/releasing code yet.

sssilver commented 3 years ago

We are currently working on packaging and publishing the cloudlared binary for Apple Silicon, unfortunately we don't have an ETA at the moment, but expect this to happen soon!

Meanwhile, the code should be buildable with small adjustments to the Makefile.

MrMage commented 3 years ago

@sssilver any updates on this? Would be great to have an ARM version of cloudflared on Homebrew.

amccarty commented 2 years ago

I was able to build this on an arm64 Mac by changing: all: cloudflared test to: all: cloudflared

on line 76. Also, make sure you have go-sumtype installed.

stepelu commented 2 years ago

@sssilver do you have a revised estimated timeline for this? I moved to a M1 MBP too, and the advised brew install method simply fails silently: cloidflared errors out with a bad file descriptor message at runtime. I would rather avoid having to compile cloudflared myself if possible.

stepelu commented 2 years ago

I ended up going ahead and compiling cloudflared following https://github.com/cloudflare/cloudflared/issues/534#issue-1085300460 It complies fine, but I am having some issues with connection stability, i.e. ssh connections sometimes die with a broken pipe error. Not sure if it's related, but on my previous machine cloudflared has always been rock solid, anyone else experiencing similar issues?

darkpiv commented 2 years ago

any updates on this?

stepelu commented 2 years ago

My brew-installed version of cloudflared started working after the latest update, so it has been done already? See: https://github.com/cloudflare/homebrew-cloudflare/blob/HEAD/cloudflared.rb

balupton commented 2 years ago

I moved to a M1 MBP too, and the advised brew install method simply fails silently: cloidflared errors out with a bad file descriptor message at runtime.

I've been using cloudflared's amd64 build via rosetta with no issue since I got my m1 mac mini middle to last year. This was the installer I wrote for handling DNS setup cross-platform, which downloads the binary directly:

https://github.com/bevry/dorothy/blob/b6908864410e2c50ede6305c955b917208f7c41a/commands/setup-dns#L142

Definitely would be good to have a native client though.

stepelu commented 2 years ago

I think the (main) issue was that up to the latest release the brew installed version just did not work: https://github.com/cloudflare/cloudflared/issues/389#issuecomment-1014961490

Joonel commented 1 year ago

Any news? :\ Still no arm support...

supertr0n commented 1 year ago

It's baffling to me that the Releases for this repo contain builds for every platform except Apple silicon, despite multiple mulit-year issues about this (eg #534).

I don't always want to do a system-wide install with brew. Plus, I didn't even bother trying this based on reading the many comments about issues with the brew version.

Unless I'm mistaken, there used to be a direct link to download the arm binary from the Cloudflare docs, but I can no longer find this.

For a recent project I've just switched (back) to Ngrok because I needed a quick solution and they provide a simple, prominent download for Apple silicon. I felt like I wasted too much time trying to find the equivalent for cloudflared.

This should concern Cloudflarers because I've now also seen that Ngrok are also creeping up with some similar features to Cloudflare Tunnel...

alphatownsman commented 1 year ago

Apple released M3, and yet still no arm64 binary from cloudflared?

slarkvan commented 6 months ago

Oops it's a sad story.

This is already 2024, and the Apple M series chips are still not being implemented.

gonzaloriestra commented 6 months ago

@sssilver @nmldiegues any news? 🙏

gonzaloriestra commented 3 months ago

The latest release finally includes it 🎉