You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get Knative with Istio(or any other Ingress controller based on Envoy) running on a Mac mini with the Apple Silicon m1 chip. And I am told that Istio is not working do to Envoy not supporting Apple m1 chip.
Description:
A working setup on Kubernetes running Istio(Envoy)
Reacted by Eleni Pastel, Vinay Reddy, Kotaro Inoue, Cole Morrison, Adrian Cole, Shinji Yamada, Nick Pan, Nim Sadeh, David Haupt, David Barroso and 8 more
My m1 Mac Mini arrived last night (16GB RAM) and I've got the development environment set up, full xcode installed, the brand new m1 native bazel 4.1.0 etc. ~/.bazelrc is:
I'm getting the following error on the first thing the process tries to compile. The xcode-locator tool it uses isn't m1 compatible even though I've installed the Darwin arm64 Bazel package.
ERROR: /private/var/tmp/_bazel_<username>/3335c71f4281d4576473beb63d032778/external/envoy/bazel/foreign_cc/BUILD:345:12: CcCmakeMakeRule external/envoy/bazel/foreign_cc/zlib/include failed: I/O exception during sandboxed execution: com.google.devtools.build.lib.shell.ExecFailedException: java.io.IOException: Cannot run program "/var/tmp/_bazel_<username>/install/d0b631b3e5a643567f221e133629d965/xcode-locator": error=86, Bad CPU type in executable
Now wondering if I should try getting the m1 compatible Azul JDK and building Bazel from source?
Build Bazel with env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" ./compile.sh
This compilation worked and produced a binary that wouldn't run generating a SIGKILL. Using lldb I could see the following error:
lldb ./envoy
(lldb) target create "./envoy"
Current executable set to '/Users/<username>/Applications/envoy/envoy' (arm64).
(lldb) process launch
error: Malformed Mach-o file
Hi, I tried building the latest codebase using the patch suggested above. Although that did get me further than before I'm now seeing the following error on M1
Use --sandbox_debug to see verbose messages from the sandbox
compilepkg: missing strict dependencies:
/private/var/tmp/_bazel_xyz/90f305687f37d42ba5f4826d49344d1b/sandbox/darwin-sandbox/117/execroot/envoy/external/com_github_lyft_protoc_gen_star/init_option.go: import of "github.com/spf13/afero"
/private/var/tmp/_bazel_xyz/90f305687f37d42ba5f4826d49344d1b/sandbox/darwin-sandbox/117/execroot/envoy/external/com_github_lyft_protoc_gen_star/persister.go: import of "github.com/spf13/afero"
No dependencies were provided.
I'm using the latest bazel to build envoy and ran bazel build source/exe:envoy
@carlocab (but anyone can answer) do you know if there's a way to avoid
explicit settings like above? Seems we want to avoid configuration, ideally
zero.
@codefromthecrypt The need to install XCODE and configure it correctly is probably unavoidable. Fortunately, the configuration is correct after installed XCODE in normal.
@carlocab Sorry, I didn't print the PATH of the active developer directory before did xcode-select --switch. What I know is that before I did bazel build bazel that I updated my XCODE.
If I did sudo xcode-select --switch /Library/Developer/CommandLineTools, there are something wrong when building enovy.
❯ bazel build envoy
INFO: Analyzed target //:envoy (1 packages loaded, 16986 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_patrick/8c59177cb250ffabcb42d9e36319c1f2/external/com_googlesource_chromium_v8/BUILD.bazel:33:8: Executing genrule @com_googlesource_chromium_v8//:build failed: (Exit 1): bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
/private/var/tmp/_bazel_patrick/8c59177cb250ffabcb42d9e36319c1f2/sandbox/darwin-sandbox/5978/execroot/envoy/external/com_googlesource_chromium_v8 /private/var/tmp/_bazel_patrick/8c59177cb250ffabcb42d9e36319c1f2/sandbox/darwin-sandbox/5978/execroot/envoy
ERROR at //build/config/mac/mac_sdk.gni:92:19: Script returned non-zero exit code.
_mac_sdk_result = exec_script(script_name, sdk_info_args, "scope")
^----------
Current dir: /private/var/tmp/_bazel_patrick/8c59177cb250ffabcb42d9e36319c1f2/sandbox/darwin-sandbox/5978/execroot/envoy/external/com_googlesource_chromium_v8/out/wee8/
Command: python3 /private/var/tmp/_bazel_patrick/8c59177cb250ffabcb42d9e36319c1f2/sandbox/darwin-sandbox/5978/execroot/envoy/external/com_googlesource_chromium_v8/build/config/apple/sdk_info.py macosx
Returned 1.
stderr:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Traceback (most recent call last):
File "/private/var/tmp/_bazel_patrick/8c59177cb250ffabcb42d9e36319c1f2/sandbox/darwin-sandbox/5978/execroot/envoy/external/com_googlesource_chromium_v8/build/config/apple/sdk_info.py", line 167, in <module>
FillXcodeVersion(settings, args.developer_dir)
File "/private/var/tmp/_bazel_patrick/8c59177cb250ffabcb42d9e36319c1f2/sandbox/darwin-sandbox/5978/execroot/envoy/external/com_googlesource_chromium_v8/build/config/apple/sdk_info.py", line 80, in FillXcodeVersion
lines = subprocess.check_output(['xcodebuild',
File "/opt/homebrew/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/opt/homebrew/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['xcodebuild', '-version']' returned non-zero exit status 1.
See //build/config/sysroot.gni:71:5: whence it was imported.
import("//build/config/mac/mac_sdk.gni")
^--------------------------------------
See //build/config/BUILDCONFIG.gn:410:23: which caused the file to be included.
_linker_configs = [ "//build/config/mac:strip_all" ]
^-----------------------------
Target //source/exe:envoy-static failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 4.012s, Critical Path: 1.80s
INFO: 3 processes: 3 internal.
FAILED: Build did NOT complete successfully
ok trying it on both my Macs prior to marking ready for review. 🤞 and thanks folks. seems we're nearly there (pending an envoy release) Homebrew/homebrew-core#90695
The error is now improved, if full Xcode isn't installed. Thanks for figuring this out @Patrick0308 and thanks for the config tip @carlocab!
$ brew install --build-from-source envoy --HEAD
envoy: A full installation of Xcode.app is required to compile
this software. Installing just the Command Line Tools is not sufficient.
Xcode can be installed from the App Store.
Error: envoy: An unsatisfied requirement failed this build.
I build successfully now. I'm not quite sure what the problem was that caused built failed. I just uninstalled anaconda and it works. I think this issue can be closed.
Activity
antoniovicente commentedon May 13, 2021
cc @ggreenway who may know more about any toolchain issues preventing build for m1's
JCzz commentedon May 14, 2021
Istio / arm is not supported
istio/istio#32751 (comment)
Envoy not supporting arm?
istio/istio#29596
istio/istio#21094
ggreenway commentedon May 14, 2021
It's on my TODO list to investigate building envoy for m1, but I don't know when I'll get to it. If someone else wants to take it up, go for it.
antoniovicente commentedon May 14, 2021
One of the challenges is availability of VMs with m1 silicon or physical hardware to test on.
ggreenway commentedon May 14, 2021
I've heard that we could get a single m1 instance for the OSS project from https://www.macstadium.com/opensource. It might be enough to setup a periodic build off of main to post-facto check for breakages. Also on my TODO list to look into.
moderation commentedon May 21, 2021
My m1 Mac Mini arrived last night (16GB RAM) and I've got the development environment set up, full xcode installed, the brand new m1 native
bazel 4.1.0etc.~/.bazelrcis:I'm getting the following error on the first thing the process tries to compile. The
xcode-locatortool it uses isn't m1 compatible even though I've installed the Darwin arm64 Bazel package.Now wondering if I should try getting the m1 compatible Azul JDK and building Bazel from source?
moderation commentedon May 22, 2021
I now have a working binary on Apple Silicon. My goal was to not have to install Rosetta:
xcode-locatorthat won't runenv EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" ./compile.shThis compilation worked and produced a binary that wouldn't run generating a
SIGKILL. UsinglldbI could see the following error:That lead me to - https://github.com/wg/wrk/issues/448
bazel/envoy_binary.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bazel/envoy_binary.bzl b/bazel/envoy_binary.bzl index 43c52bf7e..3bd40e35d 100644 --- a/bazel/envoy_binary.bzl +++ b/bazel/envoy_binary.bzl @@ -57,8 +57,8 @@ def _envoy_linkopts(): # The macOS system library transitively links common libraries (e.g., pthread). "@envoy//bazel:apple": [ # See note here: https://luajit.org/install.html - "-pagezero_size 10000", - "-image_base 100000000", + # "-pagezero_size 10000", + # "-image_base 100000000", ], "@envoy//bazel:windows_opt_build": [ "-DEFAULTLIB:ws2_32.lib",This will need to be updated with correct logic.
Lastly I don't know if this is required:This is required:bazel/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/bazel/BUILD b/bazel/BUILD index 98be980f8..66f2e364d 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -540,6 +540,7 @@ selects.config_setting_group( name = "apple", match_any = [ ":darwin", + ":darwin_arm64", ":darwin_x86_64", ":ios_arm64", ":ios_arm64e",Success!
JCzz commentedon May 22, 2021
Hi @moderation that is super cool work!
How is progress on this?
Thanks and I am looking forward to have this running in Knative and Istio :-)
JCzz commentedon Jun 1, 2021
Hi @ggreenway did you see @moderation comments?
vinayreddy commentedon Jun 9, 2021
Hi, I tried building the latest codebase using the patch suggested above. Although that did get me further than before I'm now seeing the following error on M1
I'm using the latest bazel to build envoy and ran
bazel build source/exe:envoyvinayreddy commentedon Jun 12, 2021
Also, if anyone is able to build envoy on arm64 (as suggested on this issue), can you please share the binary so others can try it out?
38 remaining items
Patrick0308 commentedon Dec 7, 2021
@keith I fixed the above problem by
sudo xcode-select --switch /Applications/Xcode.app. And It has built successfully. GOOD JOB!! THKS!!codefromthecrypt commentedon Dec 7, 2021
Patrick0308 commentedon Dec 7, 2021
@codefromthecrypt The need to install XCODE and configure it correctly is probably unavoidable. Fortunately, the configuration is correct after installed XCODE in normal.
carlocab commentedon Dec 7, 2021
@Patrick0308 would you happen to know what
xcode-select --print-pathwas before you didxcode-select --switch?Does doing
not work?
Patrick0308 commentedon Dec 7, 2021
@carlocab Sorry, I didn't print the PATH of the active developer directory before did
xcode-select --switch. What I know is that before I didbazel build bazelthat I updated my XCODE.If I did
sudo xcode-select --switch /Library/Developer/CommandLineTools, there are something wrong when building enovy.carlocab commentedon Dec 7, 2021
Ah. Chromium. The formula probably needs a
codefromthecrypt commentedon Dec 7, 2021
ok trying it on both my Macs prior to marking ready for review. 🤞 and thanks folks. seems we're nearly there (pending an envoy release) Homebrew/homebrew-core#90695
codefromthecrypt commentedon Dec 8, 2021
The error is now improved, if full Xcode isn't installed. Thanks for figuring this out @Patrick0308 and thanks for the config tip @carlocab!
Patrick0308 commentedon Dec 8, 2021
I almost did nothing except
bazel clean. But I built failed again.codefromthecrypt commentedon Dec 8, 2021
After installing, switching to, and accepting the license of full Xcode, the current main branch works for me on my M1 laptop!
Looking forward to 1.21 as it will allow homebrew to remove the arm64 exception!
Patrick0308 commentedon Feb 7, 2022
I build successfully now. I'm not quite sure what the problem was that caused built failed. I just uninstalled anaconda and it works. I think this issue can be closed.
keith commentedon Mar 4, 2022
In general I think we should close this one and encourage folks to file new issues as they pop up
davinci26 commentedon May 3, 2022
hey folks, is m1 fast at compiling envoy? Do people have a good dev experience with m1?