From 7217e82e687d3fcf700e73798c764b6450ac8c90 Mon Sep 17 00:00:00 2001 From: Paulo Valente <16843419+polvalente@users.noreply.github.com> Date: Wed, 30 Oct 2024 02:46:02 -0300 Subject: [PATCH] fix: exla rpath --- exla/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/exla/Makefile b/exla/Makefile index 695c7f9409..08674826f7 100644 --- a/exla/Makefile +++ b/exla/Makefile @@ -61,16 +61,24 @@ else NVCCFLAGS = $(CFLAGS) endif + +ifeq ($(MIX_BUILD_EMBEDDED), true) + XLA_EXTENSION_LIB_RPATH = "xla_extension/lib" +else + XLA_EXTENSION_LIB_RPATH = "../xla_extension/lib" +endif + ifeq ($(UNAME_S), Darwin) - LDFLAGS += -flat_namespace -undefined dynamic_lookup -rpath @loader_path/xla_extension/lib + LDFLAGS += -flat_namespace -undefined dynamic_lookup -rpath @loader_path/$(XLA_EXTENSION_LIB_RPATH) else # Use a relative RPATH, so at runtime libexla.so looks for libxla_extension.so # in ./lib regardless of the absolute location. This way priv can be safely # packed into an Elixir release. Also, we use $$ to escape Makefile variable # and single quotes to escape shell variable - LDFLAGS += -Wl,-rpath,'$$ORIGIN/xla_extension/lib' + LDFLAGS += -Wl,-rpath,'$$ORIGIN/$(XLA_EXTENSION_LIB_RPATH)' endif + $(EXLA_SO): $(EXLA_CACHE_SO) @ mkdir -p $(PRIV_DIR) @ mkdir -p $(PRIV_DIR)/xla_extension