Skip to content

Commit

Permalink
解决在 MacOS 系统下编译 redis 错误,原因如下:
Browse files Browse the repository at this point in the history
1、redis 编译需要指定 AR 和 RANLIB
2、redis 编译需要指定 -fPIC 参数
  • Loading branch information
joans321 committed Mar 23, 2024
1 parent e2a28f6 commit 72a5a4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apps/c/redis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARCH ?= x86_64

CC := $(ARCH)-linux-musl-gcc

CFLAGS :=
CFLAGS := -fPIC
LDFLAGS := -static -no-pie

redis-version := 7.0.12
Expand All @@ -14,6 +14,8 @@ redis-bin := redis-server

redis-build-args := \
CC=$(CC) \
AR=$(AR) \
RANLIB=$(RANLIB) \
CFLAGS="$(CFLAGS)" \
USE_JEMALLOC=no \
-j
Expand Down
4 changes: 3 additions & 1 deletion apps/c/redis/axbuild.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ redis-objs := redis-$(redis-version)/src/redis-server.o

app-objs := $(redis-objs)

CFLAGS += -Wno-format
CFLAGS += -Wno-format -fPIC

redis-build-args := \
CC=$(CC) \
AR=$(AR) \
RANLIB=$(RANLIB) \
CFLAGS="$(CFLAGS)" \
USE_JEMALLOC=no \
-j
Expand Down

0 comments on commit 72a5a4c

Please sign in to comment.