nighthawk icon indicating copy to clipboard operation
nighthawk copied to clipboard

support arm64 image?

Open zirain opened this issue 8 months ago • 1 comments

I would to run this on m1 mac, can we push arm64 image to docker hub?

cc @phlax

zirain avatar Mar 11 '25 10:03 zirain

For https://github.com/envoyproxy/nighthawk/pull/1370 I plowed through some tweaks to build and test natively with an m3 macbook:

Here's the diff I worked with, probably needs cleaning up to minimize the delta. This worked for me, except for

  • passing the integration/python tests (didn't look into this)
  • needed to exclude //test/adaptive_load/, failure:
Undefined symbols for architecture arm64:
  "protobuf::reflection::google_rpc_status::kFileDescriptorInfo", referenced from:
      protobuf::reflection::test_adaptive_load_fake_plugins_fake_metrics_plugin_fake_metrics_plugin::kDeps in fake_metrics_plugin_descriptor.pb.o
  "protobuf::reflection::envoy_config_core_v3_extension::kFileDescriptorInfo", referenced from:
      protobuf::reflection::test_adaptive_load_fake_plugins_fake_metrics_plugin_fake_metrics_plugin::kDeps in fake_metrics_plugin_descriptor.pb.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Command line that works:

bazel test //test/... -- -//test/adaptive_load/...

Diff

diff --git a/.bazelrc b/.bazelrc
index d874a63..6aa7bfe 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -53,7 +53,7 @@ build --action_env=LLVM_CONFIG --host_action_env=LLVM_CONFIG
 # Explicitly set the --host_action_env for clang build since we are not building             # unique
 # rbe-toolchain-clang that Envoy builds.                                                     # unique
 # This value is the same for different VMs, thus cache hits can be shared among machines.    # unique
-build --host_action_env=PATH=/usr/sbin:/usr/bin:/opt/llvm/bin                                # unique
+build --host_action_env=PATH=/bin:/usr/sbin:/usr/bin:/opt/llvm/bin                                # unique
 # To make our own CI green, we do need that flag on Windows though.
 build:windows --action_env=PATH --host_action_env=PATH
 
diff --git a/BUILD b/BUILD
index 6aac603..5a7d6c1 100644
--- a/BUILD
+++ b/BUILD
@@ -24,8 +24,6 @@ filegroup(
 envoy_cc_binary(
     name = "nighthawk_adaptive_load_client",
     linkopts = [
-        "-latomic",
-        "-lrt",
     ],
     repository = "@envoy",
     deps = [
@@ -36,8 +34,6 @@ envoy_cc_binary(
 envoy_cc_binary(
     name = "nighthawk_client",
     linkopts = [
-        "-latomic",
-        "-lrt",
     ],
     repository = "@envoy",
     deps = [
@@ -50,8 +46,6 @@ envoy_cc_binary(
 envoy_cc_binary(
     name = "nighthawk_client_testonly",
     linkopts = [
-        "-latomic",
-        "-lrt",
     ],
     repository = "@envoy",
     deps = [
@@ -64,8 +58,6 @@ envoy_cc_binary(
 envoy_cc_binary(
     name = "nighthawk_test_server",
     linkopts = [
-        "-latomic",
-        "-lrt",
     ],
     repository = "@envoy",
     deps = [
@@ -79,8 +71,6 @@ envoy_cc_binary(
 envoy_cc_binary(
     name = "nighthawk_service",
     linkopts = [
-        "-latomic",
-        "-lrt",
     ],
     repository = "@envoy",
     deps = [
@@ -91,8 +81,6 @@ envoy_cc_binary(
 envoy_cc_binary(
     name = "nighthawk_output_transform",
     linkopts = [
-        "-latomic",
-        "-lrt",
     ],
     repository = "@envoy",
     deps = [
diff --git a/ci/run_envoy_docker.sh b/ci/run_envoy_docker.sh
index c5fbb27..df886b7 100755
--- a/ci/run_envoy_docker.sh
+++ b/ci/run_envoy_docker.sh
@@ -35,7 +35,7 @@ else
   # We run as root and later drop permissions. This is required to setup the USER
   # in useradd below, which is need for correct Python execution in the Docker
   # environment.
-  ENVOY_DOCKER_OPTIONS+=(-u root:root)
+  ENVOY_DOCKER_OPTIONS+=(-u root:root --platform linux/amd64)
   DOCKER_USER_ARGS=()
   DOCKER_GROUP_ARGS=()
   DEFAULT_ENVOY_DOCKER_BUILD_DIR=/tmp/envoy-docker-build

oschaaf avatar Jun 18 '25 21:06 oschaaf