From 432456d309726d9d72cb2b0089cc01b95db32839 Mon Sep 17 00:00:00 2001 From: Paul RATHGEB Date: Tue, 24 Jun 2025 08:48:05 +0200 Subject: [PATCH] Fix the compiler optimization when cross compile for Linux --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 9ffc70a..1ecfac4 100644 --- a/Makefile +++ b/Makefile @@ -52,8 +52,13 @@ OBJ = $(SRC:c_src/%.c=$(BUILD)/%.o) ifneq ($(CROSSCOMPILE),) ifeq ($(CROSSCOMPILE), Android) + CFLAGS:=$(filter-out -O2,$(CFLAGS)) CFLAGS += -fPIC -Os -z global LDFLAGS += -fPIC -shared -lm + else ifeq ($(findstring linux,$(CROSSCOMPILE)),linux) + CFLAGS:=$(filter-out -O2,$(CFLAGS)) + CFLAGS += -fPIC -Os -fvisibility=hidden + LDFLAGS += -fPIC -shared else CFLAGS += -fPIC -fvisibility=hidden LDFLAGS += -fPIC -shared