elastic / otel-profiling-agent

The production-scale datacenter profiler (C/C++, Go, Rust, Python, Java, NodeJS, .NET, PHP, Ruby, Perl, ...)
Apache License 2.0
2.09k stars 229 forks source link

Is there an error in Makefile for arm64? #15

Closed MrQuansy closed 2 months ago

MrQuansy commented 2 months ago
image

In macos, command "uname -m" will return "arm64", and report Unsupported architecture here.

athre0z commented 2 months ago

Hmm yeah, we should also allow arm64 here. macOS calls the architecture arm64, Linux calls it aarch64. The build is generally only meant to be run on Linux, but at least the two Docker based targets (make docker-image and make agent) run just fine on macOS.

With this patch

diff --git a/Makefile b/Makefile
index b6c7efb..09debff 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,8 @@ UNAME_NATIVE_ARCH:=$(shell uname -m)

 ifeq ($(UNAME_NATIVE_ARCH),x86_64)
 NATIVE_ARCH:=amd64
+else ifeq ($(UNAME_NATIVE_ARCH),arm64)
+NATIVE_ARCH:=arm64
 else ifeq ($(UNAME_NATIVE_ARCH),aarch64)
 NATIVE_ARCH:=arm64
 else
diff --git a/support/ebpf/Makefile b/support/ebpf/Makefile
index f30d23d..9f6ff63 100644
--- a/support/ebpf/Makefile
+++ b/support/ebpf/Makefile
@@ -11,6 +11,8 @@ NATIVE_ARCH:=$(shell uname -m)

 ifeq ($(NATIVE_ARCH),x86_64)
 NATIVE_ARCH:=x86
+else ifeq ($(NATIVE_ARCH),arm64)
+NATIVE_ARCH:=arm64
 else ifeq ($(NATIVE_ARCH),aarch64)
 NATIVE_ARCH:=arm64
 else

It's possible to build the agent from macOS, as long as Docker is installed. I'll wrap that into a PR in a moment.