Skip to content

Instantly share code, notes, and snippets.

@sungsoo
Forked from electrum/build-native-mac.sh
Created June 16, 2014 02:46
Show Gist options
  • Save sungsoo/eba8658311122ef4385f to your computer and use it in GitHub Desktop.
Save sungsoo/eba8658311122ef4385f to your computer and use it in GitHub Desktop.
brew install snappy
CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ant compile-native
cp \
/usr/local/lib/libsnappy.dylib \
build/native/Mac_OS_X-x86_64-64/lib/libhadoop.dylib \
~/src/presto-hadoop cdh4/src/main/resources/nativelib/Mac_OS_X-x86_64/
chmod 644 src/main/resources/nativelib/Mac_OS_X-x86_64/*
commit a5681a94b83e7314a46863f811226e4e51967595
Author: David Phillips <[email protected]>
Date: Wed Oct 10 18:34:24 2012 -0700
Compile native libraries on Mac OS X
diff --git a/src/native/Makefile.am b/src/native/Makefile.am
index c70de7d..6268877 100644
--- a/src/native/Makefile.am
+++ b/src/native/Makefile.am
@@ -33,9 +33,7 @@ export PLATFORM = $(shell echo $$OS_NAME | tr [A-Z] [a-z])
AM_CPPFLAGS = @JNI_CPPFLAGS@ -I$(HADOOP_NATIVE_SRCDIR)/src \
-Isrc/org/apache/hadoop/io/compress/zlib \
- -Isrc/org/apache/hadoop/io/compress/snappy \
- -Isrc/org/apache/hadoop/io/nativeio \
- -Isrc/org/apache/hadoop/security
+ -Isrc/org/apache/hadoop/io/compress/snappy
AM_LDFLAGS = @JNI_LDFLAGS@ -m$(JVM_DATA_MODEL)
AM_CFLAGS = -g -Wall -fPIC -O2 -m$(JVM_DATA_MODEL)
@@ -43,13 +41,7 @@ lib_LTLIBRARIES = libhadoop.la
libhadoop_la_SOURCES = src/org/apache/hadoop/io/compress/zlib/ZlibCompressor.c \
src/org/apache/hadoop/io/compress/zlib/ZlibDecompressor.c \
src/org/apache/hadoop/io/compress/snappy/SnappyCompressor.c \
- src/org/apache/hadoop/io/compress/snappy/SnappyDecompressor.c \
- src/org/apache/hadoop/security/getGroup.c \
- src/org/apache/hadoop/security/JniBasedUnixGroupsMapping.c \
- src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c \
- src/org/apache/hadoop/io/nativeio/file_descriptor.c \
- src/org/apache/hadoop/io/nativeio/errno_enum.c \
- src/org/apache/hadoop/io/nativeio/NativeIO.c
+ src/org/apache/hadoop/io/compress/snappy/SnappyDecompressor.c
libhadoop_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS)
libhadoop_la_LIBADD = -ldl -ljvm
diff --git a/src/native/acinclude.m4 b/src/native/acinclude.m4
index 266ac87..48481b3 100644
--- a/src/native/acinclude.m4
+++ b/src/native/acinclude.m4
@@ -13,8 +13,10 @@ AC_CACHE_CHECK([Checking for the 'actual' dynamic-library for '-l$1'], ac_cv_lib
ac_cv_libname_$1="`objdump -p conftest | grep NEEDED | grep $1 | sed 's/\W*NEEDED\W*\(.*\)\W*$/\"\1\"/'`"
elif test ! -z "`which ldd | grep -v 'no ldd'`"; then
ac_cv_libname_$1="`ldd conftest | grep $1 | sed 's/^[[[^A-Za-z0-9]]]*\([[[A-Za-z0-9\.]]]*\)[[[^A-Za-z0-9]]]*=>.*$/\"\1\"/'`"
+ elif test ! -z "`which otool | grep -v 'no otool'`"; then
+ ac_cv_libname_$1=\"`otool -L conftest | grep $1 | sed -e 's/^[ ]*//' -e 's/ .*//' -e 's/.*\/\(.*\)$/\1/'`\";
else
- AC_MSG_ERROR(Can't find either 'objdump' or 'ldd' to compute the dynamic library for '-l$1')
+ AC_MSG_ERROR(Can't find either 'objdump', 'ldd' or 'otool' to compute the dynamic library for '-l$1')
fi
else
ac_cv_libname_$1=libnotfound.so
diff --git a/src/native/configure.ac b/src/native/configure.ac
index 71ff66d..87b34a1 100644
--- a/src/native/configure.ac
+++ b/src/native/configure.ac
@@ -56,7 +56,7 @@ JNI_LDFLAGS=""
if test $JAVA_HOME != ""
then
JNI_LDFLAGS="-L$JAVA_HOME/jre/lib/$OS_ARCH/server"
- JVMSOPATH=`find $JAVA_HOME/jre/ -name libjvm.so | head -n 1`
+ JVMSOPATH=`find $JAVA_HOME/jre/ -name 'libjvm.*' | head -n 1`
JNI_LDFLAGS="$JNI_LDFLAGS -L`dirname $JVMSOPATH`"
fi
ldflags_bak=$LDFLAGS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment