Skip to content

Commit 045454a

Browse files
committed
Check for OS instead of the architecture in Makefile
The linking issue that prompted the addition of the conditional check was due to the different compiler toolchain used on Linux (gcc) vs macos (clang). Linux can run on arm architecture too, but passing the `-undefined dynamic_lookup` flag to `gcc` would cause it to fail: ``` $ make cc -O3 -Wall -I/home/alco/.asdf/installs/erlang/25.3.2.2/erts-13.2.2.1/include \ -Ic_src/libpg_query -fPIC -lpthread -shared -undefined dynamic_lookup \ -o priv/libpg_query_ex.so c_src/libpg_query_ex.c c_src/libpg_query/libpg_query.a /usr/bin/ld: cannot find dynamic_lookup: No such file or directory collect2: error: ld returned 1 exit status make: *** [Makefile:21: priv/libpg_query_ex.so] Error 1 ```
1 parent 32d9134 commit 045454a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ CFLAGS += -I$(ERLANG_PATH)
55
LIBPG_QUERY_PATH = c_src/libpg_query
66

77
CFLAGS += -I$(LIBPG_QUERY_PATH) -fPIC
8-
UNAME_P := $(shell uname -p)
8+
99
LDFLAGS = -lpthread
10-
ifneq ($(filter arm%,$(UNAME_P)),)
10+
ifeq ($(shell uname -s),Darwin)
1111
LDFLAGS += -undefined dynamic_lookup
1212
endif
1313

0 commit comments

Comments
 (0)