From c617f19a293bb5c40f212a4ec4079330a6d4105d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 14 Oct 2019 13:45:34 +1030 Subject: [PATCH] Makefile: fix static linking. And update --enable-static, since it doesn't actually create a static binary since 65fa1c4f39418d1728cae09bd20e9c0c9476bbff. Signed-off-by: Rusty Russell --- Makefile | 5 ++++- configure | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 75bdabc13..7c19a5d6d 100644 --- a/Makefile +++ b/Makefile @@ -196,7 +196,10 @@ CONFIGURATOR_CC := $(CC) LDFLAGS += $(PIE_LDFLAGS) $(SANITIZER_FLAGS) $(COPTFLAGS) ifeq ($(STATIC),1) -LDLIBS = -L/usr/local/lib -Wl,-lgmp -lsqlite3 -lz -Wl,-lm -lpthread -ldl $(COVFLAGS) +# For MacOS, Jacob Rapoport changed this to: +# -L/usr/local/lib -Wl,-lgmp -lsqlite3 -lz -Wl,-lm -lpthread -ldl $(COVFLAGS) +# But that doesn't static link. +LDLIBS = -L/usr/local/lib -Wl,-dn -lgmp -lsqlite3 -lz -Wl,-dy -lm -lpthread -ldl $(COVFLAGS) else LDLIBS = -L/usr/local/lib -lm -lgmp -lsqlite3 -lz $(COVFLAGS) endif diff --git a/configure b/configure index a887a5eb5..6f596447b 100755 --- a/configure +++ b/configure @@ -145,7 +145,7 @@ usage() usage_with_default "--enable/disable-valgrind" "(autodetect)" echo " Valgrind binary to use for tests" usage_with_default "--enable/disable-static" "$STATIC" "enable" "disable" - echo " Static link binary" + echo " Static link sqlite3, gmp and zlib libraries" usage_with_default "--enable/disable-address-sanitizer" "$ASAN" "enable" "disable" echo " Compile with address-sanitizer" exit 1