From b67367d1e7173a73dab418c85935b64b986897b3 Mon Sep 17 00:00:00 2001 From: Gareth Davidson Date: Thu, 29 Jul 2021 05:57:02 +0100 Subject: [PATCH] allow compile on a Mac Apple's binutils ld removes externs from linked .a files unless you pass the -all_load flag, resulting in a build-time undefined symbol. Also, it uses -install_name rather than -soname I didn't change the name of the .so file. Might be a good idea to use cmake to support cross-platform compilation. --- _eSSP/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/_eSSP/Makefile b/_eSSP/Makefile index f9f25bb..a698d67 100644 --- a/_eSSP/Makefile +++ b/_eSSP/Makefile @@ -1,5 +1,13 @@ LIBS=-lstdc++ -lpthread +UNAME := $(shell uname) + +ifeq ($(UNAME), Darwin) +LINK = -Wl,-all_load,-install_name,libessp.so.1 +else +LINK = -Wl,-soname,libessp.so.1 +endif + .PHONY: clean libessp.so: @@ -8,7 +16,7 @@ libessp.so: $(CC) -c -fPIC -ggdb -g3 -o $@ $^ libessp.so: init.o ssp_helpers.o linux.o lib/bin/libitlssp.a - $(CC) -shared -fPIC -ggdb -g3 -Wl,-soname,libessp.so.1 -o $@ $^ + $(CC) -shared -fPIC -ggdb -g3 $(LINK) -o $@ $^ lib/bin/libitlssp.a: mkdir -p lib/bin/shared