Wednesday, February 26, 2020

macOS: ld: warning: directory not found for option '-L/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/usr/lib'

If your PostgreSQL extension Makefile uses PGXS like in
PG_CONFIG = pg_config
...
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
And you updated MacOS since you installed PostgreSQL, you may experience the following error at compile time :
[jerome@jeroboam] > make
...
clang -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -D_XOPEN_SOURCE  -L/usr/local/Cellar/postgresql@9.4/9.4.18/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/usr/lib  -Wl,-dead_strip_dylibs   -bundle -bundle_loader /usr/local/Cellar/postgresql@9.4/9.4.18/bin/postgres -o src/pg_proctab.so src/pg_proctab.o
ld: warning: directory not found for option '-L/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/usr/lib'
Then replace MacOSX10.13 for CPPFLAGS and LDFLAGS in
[jerome@jeroboam] > sudo vi /usr/local/Cellar/postgresql\@9.4/9.4.18/lib/pgxs/src/Makefile.global
with e.g. MacOSX10.15.