Skip to content

Commit

Permalink
allow compile on a Mac
Browse files Browse the repository at this point in the history
Apple's binutils ld removes externs from linked .a files unless you
pass the -whole_archive 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.
  • Loading branch information
Gareth Davidson committed Aug 2, 2021
1 parent 2928a80 commit e139893
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion _eSSP/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
LIBS=-lstdc++ -lpthread

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
LINK = -Wl,-whole_archive,-install_name,libessp.so.1
else
LINK = -Wl,-soname,libessp.so.1
endif

.PHONY: clean

libessp.so:
Expand All @@ -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
Expand Down

0 comments on commit e139893

Please sign in to comment.