From 1f438df5aac44e793ce3543ad0eed81c0fd34623 Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Mon, 17 Sep 2012 19:30:40 +0000 Subject: [PATCH] HADOOP-8806. libhadoop.so: dlopen should be better at locating libsnappy.so, etc. Contributed by Colin Patrick McCabe git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1386785 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../hadoop-common/src/CMakeLists.txt | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 7a8c01d6809..34967a44698 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -229,6 +229,9 @@ Release 2.0.3-alpha - Unreleased HADOOP-8755. Print thread dump when tests fail due to timeout. (Andrey Klochkov via atm) + HADOOP-8806. libhadoop.so: dlopen should be better at locating + libsnappy.so, etc. (Colin Patrick McCabe via eli) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-common-project/hadoop-common/src/CMakeLists.txt b/hadoop-common-project/hadoop-common/src/CMakeLists.txt index 5c3d77db4cd..69c52a986a7 100644 --- a/hadoop-common-project/hadoop-common/src/CMakeLists.txt +++ b/hadoop-common-project/hadoop-common/src/CMakeLists.txt @@ -109,6 +109,7 @@ add_executable(test_bulk_crc32 ) set_property(SOURCE main.cpp PROPERTY INCLUDE_DIRECTORIES "\"-Werror\" \"-Wall\"") +SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) add_dual_library(hadoop ${D}/io/compress/lz4/Lz4Compressor.c ${D}/io/compress/lz4/Lz4Decompressor.c @@ -125,6 +126,17 @@ add_dual_library(hadoop ${D}/util/NativeCrc32.c ${D}/util/bulk_crc32.c ) + +IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + # + # By embedding '$ORIGIN' into the RPATH of libhadoop.so, + # dlopen will look in the directory containing libhadoop.so. + # However, $ORIGIN is not supported by all operating systems. + # + SET_TARGET_PROPERTIES(hadoop + PROPERTIES INSTALL_RPATH "\$ORIGIN/") +ENDIF() + target_link_dual_libraries(hadoop dl ${JAVA_JVM_LIBRARY}