diff --git a/dev/builddeps-veloxbe.sh b/dev/builddeps-veloxbe.sh index 8c616db67700..4192a37b6f25 100755 --- a/dev/builddeps-veloxbe.sh +++ b/dev/builddeps-veloxbe.sh @@ -173,8 +173,9 @@ if [ "$ENABLE_VCPKG" = "ON" ]; then # vcpkg will install static depends and init build environment BUILD_OPTIONS="--build_tests=$BUILD_TESTS --enable_s3=$ENABLE_S3 --enable_gcs=$ENABLE_GCS \ --enable_hdfs=$ENABLE_HDFS --enable_abfs=$ENABLE_ABFS" - envs="$("$GLUTEN_DIR/dev/vcpkg/init.sh" ${BUILD_OPTIONS})" - eval "$envs" +# envs="$("$GLUTEN_DIR/dev/vcpkg/init.sh" ${BUILD_OPTIONS})" +# eval "$envs" + source ./dev/vcpkg/env.sh ${BUILD_OPTIONS} fi if [ "$SPARK_VERSION" = "3.2" ] || [ "$SPARK_VERSION" = "3.3" ] \ diff --git a/dev/vcpkg/env.sh b/dev/vcpkg/env.sh index 8b247a907a05..e1b9a612bddd 100755 --- a/dev/vcpkg/env.sh +++ b/dev/vcpkg/env.sh @@ -1,11 +1,37 @@ #! /bin/bash set -e +exec 3>&1 >&2 + if [ -z "${BASH_SOURCE[0]}" ] || [ "$0" == "${BASH_SOURCE[0]}" ]; then echo "env.sh should only be sourced in bash" >&2 exit 1 fi SCRIPT_ROOT="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" -init_vcpkg_env=$("${SCRIPT_ROOT}/init.sh") +init_vcpkg_env=$("${SCRIPT_ROOT}/init.sh" $@) +#init_vcpkg_env="${SCRIPT_ROOT}/init.sh $@" eval "$init_vcpkg_env" +#source ${SCRIPT_ROOT}/init.sh $@ + +export VCPKG_ROOT="$SCRIPT_ROOT/.vcpkg" +export VCPKG="$SCRIPT_ROOT/.vcpkg/vcpkg" +export VCPKG_TRIPLET=x64-linux-avx +export VCPKG_TRIPLET_INSTALL_DIR=${SCRIPT_ROOT}/vcpkg_installed/${VCPKG_TRIPLET} +export EXPORT_TOOLS_PATH="${VCPKG_TRIPLET_INSTALL_DIR}/tools/protobuf" + +#cat <&3 +if [ "\${GLUTEN_VCPKG_ENABLED:-}" != "${VCPKG_ROOT}" ]; then + export VCPKG_ROOT=${VCPKG_ROOT} + export VCPKG_MANIFEST_DIR=${SCRIPT_ROOT} + export VCPKG_TRIPLET=${VCPKG_TRIPLET} + + export CMAKE_TOOLCHAIN_FILE=${SCRIPT_ROOT}/toolchain.cmake + export PKG_CONFIG_PATH=${VCPKG_TRIPLET_INSTALL_DIR}/lib/pkgconfig:${VCPKG_TRIPLET_INSTALL_DIR}/share/pkgconfig:\${PKG_CONFIG_PATH:-} + export PATH="${EXPORT_TOOLS_PATH}:$PATH" + + export GLUTEN_VCPKG_ENABLED=${VCPKG_ROOT} +else + echo "Gluten's vcpkg environment is enabled" >&2 +fi +#EOF diff --git a/dev/vcpkg/init.sh b/dev/vcpkg/init.sh index e1940d6ee7ff..d9ee47266015 100755 --- a/dev/vcpkg/init.sh +++ b/dev/vcpkg/init.sh @@ -39,9 +39,9 @@ for arg in "$@"; do esac done -SCRIPT_ROOT="$(realpath "$(dirname "$0")")" -VCPKG_ROOT="$SCRIPT_ROOT/.vcpkg" -VCPKG="$SCRIPT_ROOT/.vcpkg/vcpkg" +export SCRIPT_ROOT="$(realpath "$(dirname "$0")")" +export VCPKG_ROOT="$SCRIPT_ROOT/.vcpkg" +export VCPKG="$SCRIPT_ROOT/.vcpkg/vcpkg" VCPKG_TRIPLET=x64-linux-avx cd "$SCRIPT_ROOT" @@ -71,10 +71,12 @@ if [ "$ENABLE_ABFS" = "ON" ]; then EXTRA_FEATURES+="--x-feature=velox-abfs" fi +echo "%%%%%% execute vcpkg install" + $VCPKG install --no-print-usage \ --triplet="${VCPKG_TRIPLET}" --host-triplet="${VCPKG_TRIPLET}" ${EXTRA_FEATURES} - -VCPKG_TRIPLET_INSTALL_DIR=${SCRIPT_ROOT}/vcpkg_installed/${VCPKG_TRIPLET} +echo "%%%%%% after vcpkg install" +export VCPKG_TRIPLET_INSTALL_DIR=${SCRIPT_ROOT}/vcpkg_installed/${VCPKG_TRIPLET} EXPORT_TOOLS_PATH= EXPORT_TOOLS_PATH="${VCPKG_TRIPLET_INSTALL_DIR}/tools/protobuf:${EXPORT_TOOLS_PATH}" @@ -86,7 +88,7 @@ if [ -f "$VCPKG_CMAKE_BIN_DIR/cmake" ]; then EXPORT_TOOLS_PATH="${VCPKG_CMAKE_BIN_DIR}:${EXPORT_TOOLS_PATH}" fi -EXPORT_TOOLS_PATH=${EXPORT_TOOLS_PATH/%:/} +export EXPORT_TOOLS_PATH=${EXPORT_TOOLS_PATH/%:/} # For fixing a build error like below when gluten's build type is Debug: # No rule to make target '/root/gluten/dev/vcpkg/vcpkg_installed/x64-linux-avx/debug/lib/libz.a', @@ -99,18 +101,3 @@ cp $VCPKG_TRIPLET_INSTALL_DIR/lib/liblzma.a $VCPKG_TRIPLET_INSTALL_DIR/debug/lib cp $VCPKG_TRIPLET_INSTALL_DIR/lib/libdwarf.a $VCPKG_TRIPLET_INSTALL_DIR/debug/lib cp $VCPKG_TRIPLET_INSTALL_DIR/lib/libhdfs3.a $VCPKG_TRIPLET_INSTALL_DIR/debug/lib || true -cat <&3 -if [ "\${GLUTEN_VCPKG_ENABLED:-}" != "${VCPKG_ROOT}" ]; then - export VCPKG_ROOT=${VCPKG_ROOT} - export VCPKG_MANIFEST_DIR=${SCRIPT_ROOT} - export VCPKG_TRIPLET=${VCPKG_TRIPLET} - - export CMAKE_TOOLCHAIN_FILE=${SCRIPT_ROOT}/toolchain.cmake - export PKG_CONFIG_PATH=${VCPKG_TRIPLET_INSTALL_DIR}/lib/pkgconfig:${VCPKG_TRIPLET_INSTALL_DIR}/share/pkgconfig:\${PKG_CONFIG_PATH:-} - export PATH="${EXPORT_TOOLS_PATH}:\$PATH" - - export GLUTEN_VCPKG_ENABLED=${VCPKG_ROOT} -else - echo "Gluten's vcpkg environment is enabled" >&2 -fi -EOF diff --git a/dev/vcpkg/toolchain.cmake b/dev/vcpkg/toolchain.cmake index 13f556007067..bc8bd8d2178b 100644 --- a/dev/vcpkg/toolchain.cmake +++ b/dev/vcpkg/toolchain.cmake @@ -1,5 +1,5 @@ set(ENABLE_GLUTEN_VCPKG ON) -set(VCPKG_MANIFEST_DIR $ENV{VCPKG_MANIFEST_DIR}) +#set(VCPKG_MANIFEST_DIR $ENV{VCPKG_MANIFEST_DIR}) set(VCPKG_TARGET_TRIPLET $ENV{VCPKG_TRIPLET}) set(VCPKG_HOST_TRIPLET $ENV{VCPKG_TRIPLET}) set(VCPKG_INSTALLED_DIR $ENV{VCPKG_MANIFEST_DIR}/vcpkg_installed) @@ -14,4 +14,5 @@ set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static-libgcc") set(CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ -static-libgcc") # Disable boost new version warning for FindBoost module -set(Boost_NO_WARN_NEW_VERSIONS ON) \ No newline at end of file +set(Boost_NO_WARN_NEW_VERSIONS ON) +