depends: Set CMAKE_INSTALL_RPATH for native packages

After #19685 started setting LDFLAGS, the INSTALL_RPATH_USE_LINK_PATH cmake
option used in the libmultiprocess build no longer works, so it is neccessary
to set CMAKE_INSTALL_RPATH as a fallback.

It's unclear currently whether the bad interaction between
INSTALL_RPATH_USE_LINK_PATH and LDFLAGS is a bug, but the issue is reported:

  https://github.com/bitcoin/bitcoin/issues/19981#issuecomment-696680877
  https://discourse.cmake.org/t/install-rpath-use-link-path-not-working-when-cmake-exe-linker-flags-ldflags-is-set/1892

Commands useful for building / testing this change

  make -C depends MULTIPROCESS=1 print-libmultiprocess_cmake
  make -C depends MULTIPROCESS=1 print-native_libmultiprocess_cmake
  make -C depends MULTIPROCESS=1 HOST=x86_64-apple-darwin16 print-libmultiprocess_cmake

  rm -rvf depends/x86_64-pc-linux-gnu/native depends/work/staging depends/work/build
  make -C depends MULTIPROCESS=1 V=1 native_libmultiprocess_staged
  for f in `find -name mpgen`; do echo == $f ==; readelf -d $f | grep -i path; done

  make -C depends MULTIPROCESS=1 V=1 native_libmultiprocess_built
  find -name CMakeCache.txt

Fixes #19981
pull/20046/head
Russell Yanofsky 4 years ago
parent 72affcb16c
commit 7d0271b5c3

@ -163,7 +163,9 @@ $(1)_cmake=env CC="$$($(1)_cc)" \
CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \ CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \
LDFLAGS="$$($(1)_ldflags)" \ LDFLAGS="$$($(1)_ldflags)" \
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)"
ifneq ($($(1)_type),build) ifeq ($($(1)_type),build)
$(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib"
else
ifneq ($(host),$(build)) ifneq ($(host),$(build))
$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system) $(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system)
$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host) $(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host)

Loading…
Cancel
Save