Skip to content

Commit 4ab7e6f

Browse files
committed
HDFS-5365. Fix libhdfs compile error on FreeBSD9. Contributed by Radim Kolar.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1533283 13f79535-47bb-0310-9956-ffa450edef68
1 parent 31b2b9b commit 4ab7e6f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ Release 2.3.0 - UNRELEASED
369369
HDFS-5336. DataNode should not output 'StartupProgress' metrics.
370370
(Akira Ajisaka via cnauroth)
371371

372+
HDFS-5365. Fix libhdfs compile error on FreeBSD9. (Radim Kolar via cnauroth)
373+
372374
Release 2.2.1 - UNRELEASED
373375

374376
INCOMPATIBLE CHANGES

hadoop-hdfs-project/hadoop-hdfs/src/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ endfunction()
6262
INCLUDE(CheckCSourceCompiles)
6363
CHECK_C_SOURCE_COMPILES("int main(void) { static __thread int i = 0; return 0; }" HAVE_BETTER_TLS)
6464

65+
# Check if we need to link dl library to get dlopen.
66+
# dlopen on Linux is in separate library but on FreeBSD its in libc
67+
INCLUDE(CheckLibraryExists)
68+
CHECK_LIBRARY_EXISTS(dl dlopen "" NEED_LINK_DL)
69+
6570
find_package(JNI REQUIRED)
6671
if (NOT GENERATED_JAVAH)
6772
# Must identify where the generated headers have been placed
@@ -89,9 +94,13 @@ add_dual_library(hdfs
8994
main/native/libhdfs/jni_helper.c
9095
main/native/libhdfs/hdfs.c
9196
)
97+
if (NEED_LINK_DL)
98+
set(LIB_DL dl)
99+
endif(NEED_LINK_DL)
100+
92101
target_link_dual_libraries(hdfs
93102
${JAVA_JVM_LIBRARY}
94-
dl
103+
${LIB_DL}
95104
pthread
96105
)
97106
dual_output_directory(hdfs target/usr/local/lib)

hadoop-hdfs-project/hadoop-hdfs/src/main/native/util/posix_util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <sys/stat.h>
2828
#include <sys/types.h>
2929
#include <unistd.h>
30+
#include <limits.h>
3031

3132
static pthread_mutex_t gTempdirLock = PTHREAD_MUTEX_INITIALIZER;
3233

0 commit comments

Comments
 (0)