Currently, we don't set rpath for llvmjit.so to include `llvm-config -- libdir`. That means you need to keep LD_LIBRARY_PATH set properly to use any non-system installation of LLVM.
This isn't unique to LLVM (we only set rpath to the postgres $libdir), so I thought it might be project policy. But I think it will be worse for LLVM (and perhaps ICU) where people are more likely to want to run specific versions. Comments? Included a simple patch, but it could use some review from someone who knows more about portable linking and our build system. Regards, Jeff Davis PS: I also noticed that a autoconf run on master generates some diffs in configure.
diff --git a/config/llvm.m4 b/config/llvm.m4 index e25ffec..582ba51 100644 --- a/config/llvm.m4 +++ b/config/llvm.m4 @@ -90,6 +90,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT], done LLVM_BINPATH=`$LLVM_CONFIG --bindir` + LLVM_LIBPATH=`$LLVM_CONFIG --libdir` # Check which functionality is present SAVE_CPPFLAGS="$CPPFLAGS" @@ -104,5 +105,6 @@ AC_DEFUN([PGAC_LLVM_SUPPORT], AC_SUBST(LLVM_CFLAGS) AC_SUBST(LLVM_CXXFLAGS) AC_SUBST(LLVM_BINPATH) + AC_SUBST(LLVM_LIBPATH) ])# PGAC_LLVM_SUPPORT diff --git a/configure b/configure index a30d7be..b070658 100755 --- a/configure +++ b/configure @@ -730,6 +730,7 @@ CPP BITCODE_CXXFLAGS BITCODE_CFLAGS CFLAGS_VECTOR +LLVM_LIBPATH LLVM_BINPATH LLVM_CXXFLAGS LLVM_CFLAGS @@ -5005,6 +5006,7 @@ fi done LLVM_BINPATH=`$LLVM_CONFIG --bindir` + LLVM_LIBPATH=`$LLVM_CONFIG --libdir` # Check which functionality is present SAVE_CPPFLAGS="$CPPFLAGS" @@ -5065,6 +5067,7 @@ _ACEOF + fi diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 2529202..e3cdc13 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -229,6 +229,7 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ LLVM_CONFIG = @LLVM_CONFIG@ LLVM_BINPATH = @LLVM_BINPATH@ +LLVM_LIBPATH = @LLVM_LIBPATH@ CLANG = @CLANG@ BITCODE_CFLAGS = @BITCODE_CFLAGS@ BITCODE_CXXFLAGS = @BITCODE_CXXFLAGS@ diff --git a/src/backend/jit/llvm/Makefile b/src/backend/jit/llvm/Makefile index e2db4ce..009ff47 100644 --- a/src/backend/jit/llvm/Makefile +++ b/src/backend/jit/llvm/Makefile @@ -39,6 +39,8 @@ OBJS=$(WIN32RES) OBJS += llvmjit.o llvmjit_error.o llvmjit_inline.o llvmjit_wrap.o # Code generation OBJS += llvmjit_expr.o llvmjit_deform.o +# Add LLVM library path to rpath +rpathdir := $(LLVM_LIBPATH):$(rpathdir) all: all-shared-lib llvmjit_types.bc