|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | + |
| 19 | +# This script is like java_jni_build.sh, but is meant for release artifacts |
| 20 | +# and hardcodes assumptions about the environment it is being run in. |
| 21 | + |
| 22 | +set -eo pipefail |
| 23 | + |
| 24 | +arrow_dir=${1} |
| 25 | +build_dir=${2} |
| 26 | +normalized_arch=$(arch) |
| 27 | +case ${normalized_arch} in |
| 28 | + aarch64) |
| 29 | + normalized_arch=aarch_64 |
| 30 | + ;; |
| 31 | +esac |
| 32 | +# The directory where the final binaries will be stored when scripts finish |
| 33 | +dist_dir=${3} |
| 34 | + |
| 35 | +echo "=== Install Archery ===" |
| 36 | +pip install -e "${arrow_dir}/dev/archery[all]" |
| 37 | + |
| 38 | +echo "=== Clear output directories and leftovers ===" |
| 39 | +# Clear output directories and leftovers |
| 40 | +rm -rf ${build_dir} |
| 41 | +rm -rf "${dist_dir}" |
| 42 | + |
| 43 | +echo "=== Building Arrow C++ libraries ===" |
| 44 | +devtoolset_version=$(rpm -qa "devtoolset-*-gcc" --queryformat %{VERSION} | \ |
| 45 | + grep -o "^[0-9]*") |
| 46 | +devtoolset_include_cpp="/opt/rh/devtoolset-${devtoolset_version}/root/usr/include/c++/${devtoolset_version}" |
| 47 | +: ${ARROW_ACERO:=ON} |
| 48 | +export ARROW_ACERO |
| 49 | +: ${ARROW_BUILD_TESTS:=ON} |
| 50 | +: ${ARROW_DATASET:=ON} |
| 51 | +export ARROW_DATASET |
| 52 | +: ${ARROW_GANDIVA:=ON} |
| 53 | +export ARROW_GANDIVA |
| 54 | +: ${ARROW_GCS:=ON} |
| 55 | +: ${ARROW_JEMALLOC:=ON} |
| 56 | +: ${ARROW_RPATH_ORIGIN:=ON} |
| 57 | +: ${ARROW_ORC:=ON} |
| 58 | +export ARROW_ORC |
| 59 | +: ${ARROW_PARQUET:=ON} |
| 60 | +: ${ARROW_S3:=ON} |
| 61 | +: ${ARROW_USE_CCACHE:=OFF} |
| 62 | +: ${CMAKE_BUILD_TYPE:=release} |
| 63 | +: ${CMAKE_UNITY_BUILD:=ON} |
| 64 | +: ${VCPKG_ROOT:=/opt/vcpkg} |
| 65 | +: ${VCPKG_FEATURE_FLAGS:=-manifests} |
| 66 | +: ${VCPKG_TARGET_TRIPLET:=${VCPKG_DEFAULT_TRIPLET:-x64-linux-static-${CMAKE_BUILD_TYPE}}} |
| 67 | +: ${GANDIVA_CXX_FLAGS:=-isystem;${devtoolset_include_cpp};-isystem;${devtoolset_include_cpp}/x86_64-redhat-linux;-lpthread} |
| 68 | + |
| 69 | +if [ "${ARROW_USE_CCACHE}" == "ON" ]; then |
| 70 | + echo "=== ccache statistics before build ===" |
| 71 | + ccache -sv 2>/dev/null || ccache -s |
| 72 | +fi |
| 73 | + |
| 74 | +export ARROW_TEST_DATA="${arrow_dir}/testing/data" |
| 75 | +export PARQUET_TEST_DATA="${arrow_dir}/cpp/submodules/parquet-testing/data" |
| 76 | +export AWS_EC2_METADATA_DISABLED=TRUE |
| 77 | + |
| 78 | +mkdir -p "${build_dir}/cpp" |
| 79 | +pushd "${build_dir}/cpp" |
| 80 | + |
| 81 | +cmake \ |
| 82 | + -DARROW_ACERO=${ARROW_ACERO} \ |
| 83 | + -DARROW_BUILD_SHARED=OFF \ |
| 84 | + -DARROW_BUILD_TESTS=ON \ |
| 85 | + -DARROW_CSV=${ARROW_DATASET} \ |
| 86 | + -DARROW_DATASET=${ARROW_DATASET} \ |
| 87 | + -DARROW_SUBSTRAIT=${ARROW_DATASET} \ |
| 88 | + -DARROW_DEPENDENCY_SOURCE="VCPKG" \ |
| 89 | + -DARROW_DEPENDENCY_USE_SHARED=OFF \ |
| 90 | + -DARROW_GANDIVA_PC_CXX_FLAGS=${GANDIVA_CXX_FLAGS} \ |
| 91 | + -DARROW_GANDIVA=${ARROW_GANDIVA} \ |
| 92 | + -DARROW_GCS=${ARROW_GCS} \ |
| 93 | + -DARROW_JEMALLOC=${ARROW_JEMALLOC} \ |
| 94 | + -DARROW_ORC=${ARROW_ORC} \ |
| 95 | + -DARROW_PARQUET=${ARROW_PARQUET} \ |
| 96 | + -DARROW_RPATH_ORIGIN=${ARROW_RPATH_ORIGIN} \ |
| 97 | + -DARROW_S3=${ARROW_S3} \ |
| 98 | + -DARROW_USE_CCACHE=${ARROW_USE_CCACHE} \ |
| 99 | + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ |
| 100 | + -DCMAKE_INSTALL_PREFIX=${ARROW_HOME} \ |
| 101 | + -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \ |
| 102 | + -DGTest_SOURCE=BUNDLED \ |
| 103 | + -DORC_SOURCE=BUNDLED \ |
| 104 | + -DORC_PROTOBUF_EXECUTABLE=${VCPKG_ROOT}/installed/${VCPKG_TARGET_TRIPLET}/tools/protobuf/protoc \ |
| 105 | + -DPARQUET_BUILD_EXAMPLES=OFF \ |
| 106 | + -DPARQUET_BUILD_EXECUTABLES=OFF \ |
| 107 | + -DPARQUET_REQUIRE_ENCRYPTION=OFF \ |
| 108 | + -DVCPKG_MANIFEST_MODE=OFF \ |
| 109 | + -DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET} \ |
| 110 | + -GNinja \ |
| 111 | + ${arrow_dir}/cpp |
| 112 | +ninja install |
| 113 | + |
| 114 | +if [ "${ARROW_BUILD_TESTS}" = "ON" ]; then |
| 115 | + # MinIO is required |
| 116 | + exclude_tests="arrow-s3fs-test" |
| 117 | + case $(arch) in |
| 118 | + aarch64) |
| 119 | + # GCS testbench is crashed on aarch64: |
| 120 | + # ImportError: ../grpc/_cython/cygrpc.cpython-38-aarch64-linux-gnu.so: |
| 121 | + # undefined symbol: vtable for std::__cxx11::basic_ostringstream< |
| 122 | + # char, std::char_traits<char>, std::allocator<char> > |
| 123 | + exclude_tests="${exclude_tests}|arrow-gcsfs-test" |
| 124 | + ;; |
| 125 | + esac |
| 126 | + # unstable |
| 127 | + exclude_tests="${exclude_tests}|arrow-acero-asof-join-node-test" |
| 128 | + exclude_tests="${exclude_tests}|arrow-acero-hash-join-node-test" |
| 129 | + # external dependency |
| 130 | + exclude_tests="${exclude_tests}|arrow-gcsfs-test" |
| 131 | + # strptime |
| 132 | + exclude_tests="${exclude_tests}|arrow-utility-test" |
| 133 | + ctest \ |
| 134 | + --exclude-regex "${exclude_tests}" \ |
| 135 | + --label-regex unittest \ |
| 136 | + --output-on-failure \ |
| 137 | + --parallel $(nproc) \ |
| 138 | + --timeout 300 |
| 139 | +fi |
| 140 | + |
| 141 | +popd |
| 142 | + |
| 143 | + |
| 144 | +JAVA_JNI_CMAKE_ARGS="" |
| 145 | +JAVA_JNI_CMAKE_ARGS="${JAVA_JNI_CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" |
| 146 | +JAVA_JNI_CMAKE_ARGS="${JAVA_JNI_CMAKE_ARGS} -DVCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}" |
| 147 | +export JAVA_JNI_CMAKE_ARGS |
| 148 | +${arrow_dir}/ci/scripts/java_jni_build.sh \ |
| 149 | + ${arrow_dir} \ |
| 150 | + ${ARROW_HOME} \ |
| 151 | + ${build_dir} \ |
| 152 | + ${dist_dir} |
| 153 | + |
| 154 | +if [ "${ARROW_USE_CCACHE}" == "ON" ]; then |
| 155 | + echo "=== ccache statistics after build ===" |
| 156 | + ccache -sv 2>/dev/null || ccache -s |
| 157 | +fi |
| 158 | + |
| 159 | + |
| 160 | +echo "=== Checking shared dependencies for libraries ===" |
| 161 | +pushd ${dist_dir} |
| 162 | +archery linking check-dependencies \ |
| 163 | + --allow ld-linux-aarch64 \ |
| 164 | + --allow ld-linux-x86-64 \ |
| 165 | + --allow libc \ |
| 166 | + --allow libdl \ |
| 167 | + --allow libgcc_s \ |
| 168 | + --allow libm \ |
| 169 | + --allow libpthread \ |
| 170 | + --allow librt \ |
| 171 | + --allow libstdc++ \ |
| 172 | + --allow libz \ |
| 173 | + --allow linux-vdso \ |
| 174 | + arrow_cdata_jni/${normalized_arch}/libarrow_cdata_jni.so \ |
| 175 | + arrow_dataset_jni/${normalized_arch}/libarrow_dataset_jni.so \ |
| 176 | + arrow_orc_jni/${normalized_arch}/libarrow_orc_jni.so \ |
| 177 | + gandiva_jni/${normalized_arch}/libgandiva_jni.so |
| 178 | +popd |
0 commit comments