From e9d795ef20531d08f8ac7dc2421ead04e101b8b9 Mon Sep 17 00:00:00 2001 From: Dennis Beatty Date: Sun, 28 Sep 2025 12:49:37 -0600 Subject: [PATCH 1/2] fix nif build --- c_src/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c_src/Makefile b/c_src/Makefile index 63a4bf5..52837db 100644 --- a/c_src/Makefile +++ b/c_src/Makefile @@ -8,6 +8,7 @@ PROJECT := sippet_nif ERTS_INCLUDE_DIR ?= $(shell erl -noshell -s init stop -eval "io:format(\"~s/erts-~s/include/\", [code:root_dir(), erlang:system_info(version)]).") ERL_INTERFACE_INCLUDE_DIR ?= $(shell erl -noshell -s init stop -eval "io:format(\"~s\", [code:lib_dir(erl_interface, include)]).") ERL_INTERFACE_LIB_DIR ?= $(shell erl -noshell -s init stop -eval "io:format(\"~s\", [code:lib_dir(erl_interface, lib)]).") +ERL_ROOT ?= $(shell erl -noshell -s init stop -eval "io:format(\"~s\", [code:root_dir()]).") ERL_VERSION := $(shell erl -noshell -eval 'io:fwrite("~s\n", [erlang:system_info(otp_release)]).' -s erlang halt) C_SRC_DIR = $(CURDIR) @@ -102,7 +103,7 @@ ifeq ($(shell expr $(ERL_VERSION) \>= 23), 1) else LDLIBS += -L $(ERL_INTERFACE_LIB_DIR) -lei -lerl_interface endif -LDFLAGS += -shared -lstdc++ +LDFLAGS += -bundle -bundle_loader $(ERL_ROOT)/erts-*/bin/beam.smp -lstdc++ # Verbosity. From 6c344c21d696bbf69265c1c0c494c0161a1e760b Mon Sep 17 00:00:00 2001 From: Dennis Beatty Date: Sun, 28 Sep 2025 12:54:04 -0600 Subject: [PATCH 2/2] only use bundle flags for macOS --- c_src/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/c_src/Makefile b/c_src/Makefile index 52837db..5c24f61 100644 --- a/c_src/Makefile +++ b/c_src/Makefile @@ -103,7 +103,13 @@ ifeq ($(shell expr $(ERL_VERSION) \>= 23), 1) else LDLIBS += -L $(ERL_INTERFACE_LIB_DIR) -lei -lerl_interface endif -LDFLAGS += -bundle -bundle_loader $(ERL_ROOT)/erts-*/bin/beam.smp -lstdc++ + +ifeq ($(PLATFORM),darwin) + LDFLAGS += -bundle -bundle_loader $(ERL_ROOT)/erts-*/bin/beam.smp +else + LDFLAGS += -shared +endif +LDFLAGS += -lstdc++ # Verbosity.