Skip to content

Commit

Permalink
fix: exla rpath
Browse files Browse the repository at this point in the history
  • Loading branch information
polvalente committed Oct 30, 2024
1 parent a21d30b commit 7217e82
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions exla/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7217e82

Please sign in to comment.