From 1986ca6fd970ffca2a1d3b19c98537c5611a703f Mon Sep 17 00:00:00 2001 From: agicy <2359800311@qq.com> Date: Wed, 10 Dec 2025 00:04:05 +0000 Subject: [PATCH 1/2] fix(Makefile): update CFLAGS and LDFLAGS for static linking --- tools/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index c76db7b..eeee30c 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -3,7 +3,7 @@ objects ?= $(sources:.c=.o) ivc_demo_object ?= ivc_demo.o rpmsg_demo_object ?= rpmsg_demo.o hvisor_objects ?= $(filter-out $(ivc_demo_object) $(rpmsg_demo_object), $(objects)) -ROOT ?= / +ROOT ?= # gnu or musl LIBC ?= gnu @@ -31,7 +31,13 @@ else toolchain := $(CCARCH)-linux-$(LIBC) endif -CFLAGS := -Wall -Wextra -DLOG_USE_COLOR -DHLOG=$(LOG) --sysroot=$(ROOT) +CFLAGS := -Wall -Wextra -DLOG_USE_COLOR -DHLOG=$(LOG) -pthread + +# Conditionally add sysroot if ROOT is set +# Otherwise use default flags from cross-compiler +ifneq ($(ROOT),) +CFLAGS += --sysroot=$(ROOT) +endif include_dirs := -I../include -I./include -I../cJSON @@ -39,7 +45,7 @@ ifeq ($(LIBC), musl) include_dirs += -I./compat/ endif -LDFLAGS := -lpthread +LDFLAGS := -pthread -static # LIBS := -L$(ROOT)/usr/lib/$(toolchain) -L$(ROOT)/lib # LIBS := -L/opt/aarch64-linux-musl-cross/aarch64-linux-musl -L/opt/aarch64-linux-musl-cross/lib From ec5cf9ddc330c18b726942975d810a184229dbb9 Mon Sep 17 00:00:00 2001 From: lxh Date: Wed, 10 Dec 2025 16:46:19 +0800 Subject: [PATCH 2/2] Change LDFLAGS to use -lpthread instead of -pthread --- tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index eeee30c..870bf77 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -45,7 +45,7 @@ ifeq ($(LIBC), musl) include_dirs += -I./compat/ endif -LDFLAGS := -pthread -static +LDFLAGS := -lpthread -static # LIBS := -L$(ROOT)/usr/lib/$(toolchain) -L$(ROOT)/lib # LIBS := -L/opt/aarch64-linux-musl-cross/aarch64-linux-musl -L/opt/aarch64-linux-musl-cross/lib