提交 227614e9 编写于 作者: S Shaoqi Bai 提交者: Shaoqi Bai

Using $ORIGIN as RUNPATH for runtime link

When upgrading from GPDB5 to GPDB6, gpupgrade will need to be able to call
binaries from both major versions. Relying on LD_LIBRARY_PATH is not an option
because this can cause binaries to load libraries from the wrong version.
Instead, we need the libraries to have RPATH/RUNPATH set correctly. Since the
built binaries may be relocated we need to use a relative path.

This commit disables the rpath configure option (which would result in an
absolute path) and exports LD_RUN_PATH to use `$ORIGIN`.

For most ELF files a RUNPATH of `$ORIGIN/../lib` is correct. For pygresql
python module, the RUNPATH needs to be adjusted accordingly.
Authored-by: NShaoqi Bai <sbai@pivotal.io>
上级 2eee1d1e
......@@ -253,6 +253,12 @@ ifdef ADDON_DIR
CONFIGFLAGS+=ADDON_DIR=$(ADDON_DIR)
endif
ifneq "$(findstring $(BLD_ARCH),rhel6 rhel7)" ""
CONFIGFLAGS+= --disable-rpath
CONFIGFLAGS+= LDFLAGS='-Wl,--enable-new-dtags -Wl,-rpath,\$$$$ORIGIN/../lib'
CONFIGFLAGS+= LDFLAGS_SL='-Wl,--enable-new-dtags -Wl,-rpath,\$$$$ORIGIN/../lib'
endif
RECONFIG :
rm -f Debug/GNUmakefile
rm -f Release/GNUmakefile
......@@ -334,7 +340,11 @@ BLD_GPDB_BUILDSET=$($(BLD_ARCH)_GPDB_BUILDSET)
# set default build steps
define BUILD_STEPS
@rm -rf $(INSTLOC)
cd $(BUILDDIR) && $(MAKE) $(PARALLEL_MAKE_OPTS) install
if [ "$(findstring $(BLD_ARCH),rhel6 rhel7)" = "" ]; then \
cd $(BUILDDIR) && $(MAKE) $(PARALLEL_MAKE_OPTS) install; \
else \
cd $(BUILDDIR) && PYGRESQL_LDFLAGS='-Wl,-rpath,\$$$$ORIGIN/../../../lib -Wl,--enable-new-dtags' $(MAKE) $(PARALLEL_MAKE_OPTS) install; \
fi \
#@$(MAKE) greenplum_path INSTLOC=$(INSTLOC)
#@$(MAKE) mgmtcopy INSTLOC=$(INSTLOC)
@$(MAKE) mkpgbouncer INSTLOC=$(INSTLOC) BUILDDIR=$(BUILDDIR)
......
......@@ -64,7 +64,7 @@ pygresql:
elif [ "$(BLD_ARCH)" = 'aix7_ppc_64' ]; then \
cd $(PYLIB_SRC)/$(PYGRESQL_DIR) && DESTDIR="$(DESTDIR)" CC="$(CC)" python_64 setup.py build; \
else \
cd $(PYLIB_SRC)/$(PYGRESQL_DIR) && DESTDIR="$(DESTDIR)" CC="$(CC)" python setup.py build; \
cd $(PYLIB_SRC)/$(PYGRESQL_DIR) && DESTDIR="$(DESTDIR)" CC="$(CC)" LDFLAGS='$(LDFLAGS) $(PYGRESQL_LDFLAGS)' python setup.py build; \
fi
mkdir -p $(PYLIB_DIR)/pygresql
if [ `uname -s` = 'Darwin' ]; then \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册