This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-graalvm-distro.git
The following commit(s) were added to refs/heads/main by this push:
new b530e20 Add native-image-macos target for cross-building Linux native
binary on macOS
b530e20 is described below
commit b530e20f093e61665678ec155b0fb0b5ae51f835
Author: Wu Sheng <[email protected]>
AuthorDate: Wed Feb 25 08:23:37 2026 +0800
Add native-image-macos target for cross-building Linux native binary on
macOS
Compiles on the host (platform-independent bytecode), then runs only
the native-image step inside a GraalVM Docker container with volume
mounts for .m2 cache and project directory.
---
Makefile | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 3062af1..98461ee 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ SW_VERSION := $(shell grep '<revision>' skywalking/pom.xml |
head -1 | sed 's/.*
MVN := ./mvnw
MVN_ARGS := -Dskywalking.version=$(SW_VERSION)
-.PHONY: all clean build init-submodules build-skywalking build-distro compile
test javadoc dist info docker-up docker-down boot shutdown native-image
native-dist trace-agent docker-native
+.PHONY: all clean build init-submodules build-skywalking build-distro compile
test javadoc dist info docker-up docker-down boot shutdown native-image
native-image-macos native-dist trace-agent docker-native
all: build
@@ -96,6 +96,18 @@ shutdown:
native-image: compile
$(MVN) package -pl oap-graalvm-native -Pnative -DskipTests $(MVN_ARGS)
+# Build Linux native image from macOS using Docker.
+# Java compilation is platform-independent (already done on host via
`compile`).
+# Only the native-image step needs Linux — runs inside a GraalVM container
+# with the host .m2 cache and project dir mounted.
+native-image-macos: compile
+ docker run --rm --entrypoint bash \
+ -v $(HOME)/.m2:/root/.m2 \
+ -v $(CURDIR):/workspace \
+ -w /workspace \
+ ghcr.io/graalvm/native-image-community:25 \
+ ./mvnw package -pl oap-graalvm-native -Pnative -DskipTests
$(MVN_ARGS)
+
# Run tracing agent to capture supplementary native-image metadata
# Merges with pre-generated reflect-config.json from the precompiler
trace-agent: build-distro docker-up