From ad6da54be6d28f6100ccb0d519f5a0c16df960cf Mon Sep 17 00:00:00 2001 From: midipix Date: Dec 07 2018 03:49:09 +0000 Subject: shared library linking: properly support systems with separate libc modules. --- diff --git a/project/extras.mk b/project/extras.mk index 99fa4f6..5cda9e8 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -12,6 +12,12 @@ CFLAGS_CONFIG += -DEXEC_PREFIX=\"$(EXEC_PREFIX)\" CFLAGS_CONFIG += -DVPATH=\"$(SOURCE_DIR)\" CFLAGS_CONFIG += -DPYTHONPATH=\"$(PYTHON_PATH)\" +LDFLAGS_DEPS += -Wl,--as-needed +LDFLAGS_DEPS += -lm -lpthread -lutil -ldl -lcrypt +LDFLAGS_DEPS += -Wl,--no-as-needed + +LDFLAGS_CONFIG += $(LDFLAGS_DEPS) + ifeq ($(ALL_STATIC),yes) CFLAGS_STATIC += -DPY_ALL_STATIC @@ -36,7 +42,8 @@ pyext/%$(OS_LIB_SUFFIX): LDFLAGS_DSOEXT = -Wl,-soname -Wl,$(subst pyext/,,$@) pyext/%$(OS_LIB_SUFFIX): LDFLAGS_DYNEXT = $(LDFLAGS_DSOEXT) $(LDFLAGS_PYEXT) pyext/%$(OS_LIB_SUFFIX): $(DSO_REF_SOLINK) - $(CC) -shared -o $@ $^ $(LDFLAGS_SHARED) $(LDFLAGS_DYNEXT) -l$(PACKAGE) + $(CC) -shared -o $@ $^ $(LDFLAGS_SHARED) $(LDFLAGS_DYNEXT) \ + -l$(PACKAGE) $(LDFLAGS_DEPS) # statically linked extension