From 3071ba007051cb863146753c3e98dd721589f913 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Mon, 7 Aug 2017 14:47:34 -0700 Subject: [PATCH] Add correct Python executable to Path when building arrow. (#820) * Tell cmake which python to use when building arrow. * Pass different path into cmake when building arrow so that cmake finds the right python. * Add correct python executable to PATH when running cmake for ray. --- build.sh | 18 ++++++++++++++---- src/thirdparty/build_thirdparty.sh | 7 +++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 43bd1d13a..d9bc39f9d 100755 --- a/build.sh +++ b/build.sh @@ -32,17 +32,27 @@ popd bash "$ROOT_DIR/src/thirdparty/download_thirdparty.sh" bash "$ROOT_DIR/src/thirdparty/build_thirdparty.sh" $PYTHON_EXECUTABLE +# Get the directory of the Python executable. +PYTHON_EXECUTABLE_DIR=$(dirname $PYTHON_EXECUTABLE) + # Now build everything. pushd "$ROOT_DIR/python/ray/core" # We use these variables to set PKG_CONFIG_PATH, which is important so that # in cmake, pkg-config can find plasma. TP_DIR=$ROOT_DIR/src/thirdparty ARROW_HOME=$TP_DIR/arrow/cpp/build/cpp-install - if [ "$VALGRIND" = "1" ] - then - PKG_CONFIG_PATH=$ARROW_HOME/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Debug ../../.. + if [[ "$VALGRIND" = "1" ]]; then + # Pass a slightly different path into this command so that cmake finds the + # right Python interpreter and libraries. + PATH=$PYTHON_EXECUTABLE_DIR:$PATH \ + PKG_CONFIG_PATH=$ARROW_HOME/lib/pkgconfig \ + cmake -DCMAKE_BUILD_TYPE=Debug ../../.. else - PKG_CONFIG_PATH=$ARROW_HOME/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release ../../.. + # Pass a slightly different path into this command so that cmake finds the + # right Python interpreter and libraries. + PATH=$PYTHON_EXECUTABLE_DIR:$PATH \ + PKG_CONFIG_PATH=$ARROW_HOME/lib/pkgconfig \ + cmake -DCMAKE_BUILD_TYPE=Release ../../.. fi make clean make -j${PARALLEL} diff --git a/src/thirdparty/build_thirdparty.sh b/src/thirdparty/build_thirdparty.sh index be7095e5b..c4f75e1c4 100755 --- a/src/thirdparty/build_thirdparty.sh +++ b/src/thirdparty/build_thirdparty.sh @@ -31,6 +31,13 @@ cd $TP_DIR/arrow/cpp mkdir -p $TP_DIR/arrow/cpp/build cd $TP_DIR/arrow/cpp/build export ARROW_HOME=$TP_DIR/arrow/cpp/build/cpp-install + +# Get the directory of the Python executable. +PYTHON_EXECUTABLE_DIR=$(dirname $PYTHON_EXECUTABLE) + +# Pass a slightly different path into this command so that cmake finds the right +# Python interpreter and libraries. +PATH=$PYTHON_EXECUTABLE_DIR:$PATH \ cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_FLAGS="-g -O3" \ -DCMAKE_CXX_FLAGS="-g -O3" \