File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ ifeq ($(TIMESYNC),1)
8282endif
8383
8484OS = $(shell uname -s)
85+ ARCH = $(shell uname -m)
8586
8687KRUN_BINARY_Linux = libkrun$(VARIANT ) .so.$(FULL_VERSION )
8788KRUN_SONAME_Linux = libkrun$(VARIANT ) .so.$(ABI_VERSION )
@@ -109,10 +110,18 @@ all: $(LIBRARY_RELEASE_$(OS)) libkrun.pc
109110
110111debug : $(LIBRARY_DEBUG_$(OS ) ) libkrun.pc
111112
113+ ifeq ($(SYSROOT_LINUX ) ,)
114+ # Build on Linux host
115+ CC_LINUX =$(CC )
116+ else
117+ # Cross-compile on macOS with the LLVM linker (brew install lld)
118+ CC_LINUX =clang -target $(ARCH ) -linux-gnu -fuse-ld=lld -Wl,-strip-debug --sysroot $(SYSROOT_LINUX ) -Wno-c23-extensions
119+ endif
120+
112121ifeq ($(BUILD_INIT ) ,1)
113122INIT_BINARY = init/init
114123$(INIT_BINARY ) : $(INIT_SRC )
115- $(CC ) -O2 -static -Wall $(INIT_DEFS ) -o $@ $(INIT_SRC ) $(INIT_DEFS )
124+ $(CC_LINUX ) -O2 -static -Wall $(INIT_DEFS ) -o $@ $(INIT_SRC ) $(INIT_DEFS )
116125endif
117126
118127NITRO_INIT_BINARY = init/nitro/init
You can’t perform that action at this time.
0 commit comments