Skip to content

Commit

Permalink
ARROW-7615: [CI][Gandiva] Ensure gandiva_jni library has only a white…
Browse files Browse the repository at this point in the history
…listed set of shared dependencies

Closes #6423 from projjal/travis_debug and squashes the following commits:

fefe0d1 <Projjal Chanda> set macos_target if already set
76b6ef7 <Projjal Chanda> added a print statement
d03c3e3 <Projjal Chanda> check based on environment variable
4f10a74 <Projjal Chanda> Check shared dependecies against whitelisted set

Authored-by: Projjal Chanda <iam@pchanda.com>
Signed-off-by: Praveen <praveen@dremio.com>
  • Loading branch information
projjal authored and praveenbingo committed Feb 17, 2020
1 parent f41b863 commit 4ffa286
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
30 changes: 29 additions & 1 deletion dev/tasks/gandiva-jars/build-java.sh
Expand Up @@ -23,7 +23,35 @@ CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/dist/

pushd java
if [ $TRAVIS_OS_NAME == "linux" ]; then
ldd $CPP_BUILD_DIR/libgandiva_jni.so
SO_DEP=ldd
GANDIVA_LIB="$CPP_BUILD_DIR"libgandiva_jni.so
WHITELIST=(linux-vdso libz librt libdl libpthread libstdc++ libm libgcc_s libc ld-linux-x86-64)
else
SO_DEP="otool -L"
GANDIVA_LIB="$CPP_BUILD_DIR"libgandiva_jni.dylib
WHITELIST=(libgandiva_jni libz libncurses libSystem libc++)
fi

# print the shared library dependencies
eval "$SO_DEP" "$GANDIVA_LIB"

if [[ $CHECK_SHARED_DEPENDENCIES ]] ; then
# exit if any shared library not in whitelisted set is found
echo "Checking shared dependencies"
while read -r line
do
found=false
for item in "${WHITELIST[@]}"
do
if [[ "$line" == *"$item"* ]] ; then
found=true
fi
done
if [[ "$found" == false ]] ; then
echo "Unexpected shared dependency found"
exit 1
fi
done < <(eval "$SO_DEP" "$GANDIVA_LIB" | awk '{print $1}')
fi

# build the entire project
Expand Down
3 changes: 3 additions & 0 deletions dev/tasks/gandiva-jars/travis.osx.yml
Expand Up @@ -53,6 +53,9 @@ script:
- dev/tasks/gandiva-jars/build-cpp-osx.sh || travis_terminate 1
- dev/tasks/gandiva-jars/build-java.sh || travis_terminate 1
# deploy using crossbow
# pip install pygit2 fails if MACOS_DEPLOYMENT_TARGET is set to an earlier version. Since the
# gandiva libraries are already built we can reset MACOS_DEPLOYMENT_TARGET to current osx version
- if [[ $MACOSX_DEPLOYMENT_TARGET ]] ; then export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1,2) ; fi
- brew install libgit2
- pip3 install click github3.py jinja2 jira pygit2 ruamel.yaml setuptools_scm toolz
- >
Expand Down

0 comments on commit 4ffa286

Please sign in to comment.