1 Star 0 Fork 1

SuperJay/starrocks

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.sh 26.66 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
##############################################################
# This script is used to compile StarRocks
# Usage:
# sh build.sh --help
# Eg:
# sh build.sh build all
# sh build.sh --be build Backend without clean
# sh build.sh --fe --clean clean and build Frontend and Spark Dpp application
# sh build.sh --fe --be --clean clean and build Frontend, Spark Dpp application and Backend
# sh build.sh --spark-dpp build Spark DPP application alone
# sh build.sh --hive-udf build Hive UDF alone
# BUILD_TYPE=build_type ./build.sh --be build Backend is different mode (build_type could be Release, Debug, or Asan. Default value is Release. To build Backend in Debug mode, you can execute: BUILD_TYPE=Debug ./build.sh --be)
#
# You need to make sure all thirdparty libraries have been
# compiled and installed correctly.
##############################################################
startTime=$(date +%s)
ROOT=`dirname "$0"`
ROOT=`cd "$ROOT"; pwd`
MACHINE_TYPE=$(uname -m)
export STARROCKS_HOME=${ROOT}
if [ -z $BUILD_TYPE ]; then
export BUILD_TYPE=Release
fi
cd $STARROCKS_HOME
if [ -z $STARROCKS_VERSION ]; then
tag_name=$(git describe --tags --exact-match 2>/dev/null)
branch_name=$(git symbolic-ref -q --short HEAD)
if [ ! -z $tag_name ]; then
export STARROCKS_VERSION=$tag_name
elif [ ! -z $branch_name ]; then
export STARROCKS_VERSION=$branch_name
else
export STARROCKS_VERSION=$(git rev-parse --short=7 HEAD)
fi
fi
if [ -z $STARROCKS_COMMIT_HASH ] ; then
export STARROCKS_COMMIT_HASH=$(git rev-parse --short=7 HEAD)
fi
set -eo pipefail
. ${STARROCKS_HOME}/env.sh
if [[ $OSTYPE == darwin* ]] ; then
PARALLEL=$(sysctl -n hw.ncpu)
# We know for sure that build-thirdparty.sh will fail on darwin platform, so just skip the step.
else
if [[ ! -f ${STARROCKS_THIRDPARTY}/installed/llvm/lib/libLLVMInstCombine.a ]]; then
echo "Thirdparty libraries need to be build ..."
${STARROCKS_THIRDPARTY}/build-thirdparty.sh
fi
PARALLEL=$[$(nproc)/4+1]
fi
# Check args
usage() {
echo "
Usage: $0 <options>
Optional options:
--be build Backend
--format-lib build StarRocks format library, only with shared-data mode cluster
--fe build Frontend and Spark Dpp application
--spark-dpp build Spark DPP application
--hive-udf build Hive UDF
--clean clean and build target
--enable-shared-data
build Backend with shared-data feature support
--use-staros DEPRECATED, an alias of --enable-shared-data option
--with-gcov build Backend with gcov, has an impact on performance
--without-gcov build Backend without gcov(default)
--with-bench build Backend with bench(default without bench)
--with-clang-tidy build Backend with clang-tidy(default without clang-tidy)
--without-java-ext build Backend without java-extensions(default with java-extensions)
--without-starcache
build Backend without starcache library
-j build Backend parallel
--output-compile-time
save a list of the compile time for every C++ file in ${ROOT}/compile_times.txt.
Turning this option on automatically disables ccache.
--without-tenann
build without vector index tenann library
--with-compress-debug-symbol {ON|OFF}
build with compressing debug symbol. (default: $WITH_COMPRESS)
--with-source-file-relative-path {ON|OFF}
build source file with relative path. (default: $WITH_RELATIVE_SRC_PATH)
-h,--help Show this help message
Eg.
$0 build all
$0 --be build Backend without clean
$0 --format-lib build StarRocks format library without clean
$0 --fe --clean clean and build Frontend and Spark Dpp application
$0 --fe --be --clean clean and build Frontend, Spark Dpp application and Backend
$0 --spark-dpp build Spark DPP application alone
$0 --hive-udf build Hive UDF
BUILD_TYPE=build_type ./build.sh --be build Backend is different mode (build_type could be Release, Debug, or Asan. Default value is Release. To build Backend in Debug mode, you can execute: BUILD_TYPE=Debug ./build.sh --be)
"
exit 1
}
OPTS=$(getopt \
-n $0 \
-o 'hj:' \
-l 'be' \
-l 'format-lib' \
-l 'fe' \
-l 'spark-dpp' \
-l 'hive-udf' \
-l 'clean' \
-l 'with-gcov' \
-l 'with-bench' \
-l 'with-clang-tidy' \
-l 'without-gcov' \
-l 'without-java-ext' \
-l 'without-starcache' \
-l 'with-brpc-keepalive' \
-l 'use-staros' \
-l 'enable-shared-data' \
-l 'output-compile-time' \
-l 'without-tenann' \
-l 'with-compress-debug-symbol:' \
-l 'with-source-file-relative-path:' \
-l 'help' \
-- "$@")
if [ $? != 0 ] ; then
usage
fi
eval set -- "$OPTS"
BUILD_BE=
BUILD_FORMAT_LIB=
BUILD_FE=
BUILD_SPARK_DPP=
BUILD_HIVE_UDF=
CLEAN=
RUN_UT=
WITH_GCOV=OFF
WITH_BENCH=OFF
WITH_CLANG_TIDY=OFF
WITH_COMPRESS=ON
WITH_STARCACHE=ON
USE_STAROS=OFF
BUILD_JAVA_EXT=ON
OUTPUT_COMPILE_TIME=OFF
WITH_TENANN=ON
WITH_RELATIVE_SRC_PATH=ON
MSG=""
MSG_FE="Frontend"
MSG_DPP="Spark Dpp application"
MSG_BE="Backend"
MSG_FORMAT_LIB="Format Lib"
if [[ -z ${USE_AVX2} ]]; then
USE_AVX2=ON
fi
if [[ -z ${USE_AVX512} ]]; then
## Disable it by default
USE_AVX512=OFF
fi
if [[ -z ${USE_SSE4_2} ]]; then
USE_SSE4_2=ON
fi
if [[ -z ${USE_BMI_2} ]]; then
USE_BMI_2=ON
fi
if [[ -z ${JEMALLOC_DEBUG} ]]; then
JEMALLOC_DEBUG=OFF
fi
if [[ -z ${ENABLE_JIT} ]]; then
ENABLE_JIT=ON
fi
if [[ -z ${CCACHE} ]] && [[ -x "$(command -v ccache)" ]]; then
CCACHE=ccache
fi
if [ -e /proc/cpuinfo ] ; then
# detect cpuinfo
if [[ -z $(grep -o 'avx[^ ]\+' /proc/cpuinfo) ]]; then
USE_AVX2=OFF
fi
if [[ -z $(grep -o 'avx512' /proc/cpuinfo) ]]; then
USE_AVX512=OFF
fi
if [[ -z $(grep -o 'sse4[^ ]*' /proc/cpuinfo) ]]; then
USE_SSE4_2=OFF
fi
if [[ -z $(grep -o 'bmi2' /proc/cpuinfo) ]]; then
USE_BMI_2=OFF
fi
fi
if [[ -z ${ENABLE_QUERY_DEBUG_TRACE} ]]; then
ENABLE_QUERY_DEBUG_TRACE=OFF
fi
if [[ -z ${ENABLE_FAULT_INJECTION} ]]; then
ENABLE_FAULT_INJECTION=OFF
fi
HELP=0
if [ $# == 1 ] ; then
# default. `sh build.sh``
BUILD_BE=1
BUILD_FE=1
BUILD_SPARK_DPP=1
BUILD_HIVE_UDF=1
BUILD_FORMAT_LIB=0
CLEAN=0
RUN_UT=0
elif [[ $OPTS =~ "-j " ]] && [ $# == 3 ]; then
# default. `sh build.sh -j 32`
BUILD_BE=1
BUILD_FE=1
BUILD_SPARK_DPP=1
BUILD_HIVE_UDF=1
BUILD_FORMAT_LIB=0
CLEAN=0
RUN_UT=0
PARALLEL=$2
else
BUILD_BE=0
BUILD_FORMAT_LIB=0
BUILD_FE=0
BUILD_SPARK_DPP=0
BUILD_HIVE_UDF=0
CLEAN=0
RUN_UT=0
while true; do
case "$1" in
--be) BUILD_BE=1 ; shift ;;
--format-lib) BUILD_FORMAT_LIB=1 ; shift ;;
--fe) BUILD_FE=1 ; shift ;;
--spark-dpp) BUILD_SPARK_DPP=1 ; shift ;;
--hive-udf) BUILD_HIVE_UDF=1 ; shift ;;
--clean) CLEAN=1 ; shift ;;
--ut) RUN_UT=1 ; shift ;;
--with-gcov) WITH_GCOV=ON; shift ;;
--without-gcov) WITH_GCOV=OFF; shift ;;
--enable-shared-data|--use-staros) USE_STAROS=ON; shift ;;
--with-bench) WITH_BENCH=ON; shift ;;
--with-clang-tidy) WITH_CLANG_TIDY=ON; shift ;;
--without-java-ext) BUILD_JAVA_EXT=OFF; shift ;;
--without-starcache) WITH_STARCACHE=OFF; shift ;;
--output-compile-time) OUTPUT_COMPILE_TIME=ON; shift ;;
--without-tenann) WITH_TENANN=OFF; shift ;;
--with-compress-debug-symbol) WITH_COMPRESS=$2 ; shift 2 ;;
--with-source-file-relative-path) WITH_RELATIVE_SRC_PATH=$2 ; shift 2 ;;
-h) HELP=1; shift ;;
--help) HELP=1; shift ;;
-j) PARALLEL=$2; shift 2 ;;
--) shift ; break ;;
*) echo "Internal error" ; exit 1 ;;
esac
done
fi
if [[ ${HELP} -eq 1 ]]; then
usage
exit
fi
if [ ${CLEAN} -eq 1 ] && [ ${BUILD_BE} -eq 0 ] && [ ${BUILD_FORMAT_LIB} -eq 0 ] && [ ${BUILD_FE} -eq 0 ] && [ ${BUILD_SPARK_DPP} -eq 0 ] && [ ${BUILD_HIVE_UDF} -eq 0 ]; then
echo "--clean can not be specified without --fe or --be or --format-lib or --spark-dpp or --hive-udf"
exit 1
fi
if [ ${BUILD_BE} -eq 1 ] && [ ${BUILD_FORMAT_LIB} -eq 1 ]; then
echo "--format-lib can not be specified with --be"
exit 1
fi
if [ ${BUILD_FORMAT_LIB} -eq 1 ]; then
echo "do not build java extendsions when build format-lib."
BUILD_JAVA_EXT=OFF
fi
echo "Get params:
BUILD_BE -- $BUILD_BE
BUILD_FORMAT_LIB -- $BUILD_FORMAT_LIB
BE_CMAKE_TYPE -- $BUILD_TYPE
BUILD_FE -- $BUILD_FE
BUILD_SPARK_DPP -- $BUILD_SPARK_DPP
BUILD_HIVE_UDF -- $BUILD_HIVE_UDF
CCACHE -- ${CCACHE}
CLEAN -- $CLEAN
RUN_UT -- $RUN_UT
WITH_GCOV -- $WITH_GCOV
WITH_BENCH -- $WITH_BENCH
WITH_CLANG_TIDY -- $WITH_CLANG_TIDY
WITH_COMPRESS_DEBUG_SYMBOL -- $WITH_COMPRESS
WITH_STARCACHE -- $WITH_STARCACHE
ENABLE_SHARED_DATA -- $USE_STAROS
USE_AVX2 -- $USE_AVX2
USE_AVX512 -- $USE_AVX512
USE_SSE4_2 -- $USE_SSE4_2
USE_BMI_2 -- $USE_BMI_2
JEMALLOC_DEBUG -- $JEMALLOC_DEBUG
PARALLEL -- $PARALLEL
ENABLE_QUERY_DEBUG_TRACE -- $ENABLE_QUERY_DEBUG_TRACE
ENABLE_FAULT_INJECTION -- $ENABLE_FAULT_INJECTION
BUILD_JAVA_EXT -- $BUILD_JAVA_EXT
OUTPUT_COMPILE_TIME -- $OUTPUT_COMPILE_TIME
WITH_TENANN -- $WITH_TENANN
WITH_RELATIVE_SRC_PATH -- $WITH_RELATIVE_SRC_PATH
"
check_tool()
{
local toolname=$1
if [ -e $STARROCKS_THIRDPARTY/installed/bin/$toolname ] ; then
return 0
fi
if which $toolname &>/dev/null ; then
return 0
fi
return 1
}
# check protoc and thrift
for tool in protoc thrift
do
if ! check_tool $tool ; then
echo "Can't find command tool '$tool'!"
exit 1
fi
done
# Clean and build generated code
echo "Build generated code"
cd ${STARROCKS_HOME}/gensrc
if [ ${CLEAN} -eq 1 ]; then
make clean
rm -rf ${STARROCKS_HOME}/fe/fe-core/target
fi
# DO NOT using parallel make(-j) for gensrc
make
cd ${STARROCKS_HOME}
if [[ "${MACHINE_TYPE}" == "aarch64" ]]; then
export LIBRARY_PATH=${JAVA_HOME}/jre/lib/aarch64/server/
WITH_TENANN=OFF
else
export LIBRARY_PATH=${JAVA_HOME}/jre/lib/amd64/server/
fi
# Clean and build Backend
if [ ${BUILD_BE} -eq 1 ] || [ ${BUILD_FORMAT_LIB} -eq 1 ] ; then
if ! ${CMAKE_CMD} --version; then
echo "Error: cmake is not found"
exit 1
fi
# When build starrocks format lib, USE_STAROS must be ON
if [ ${BUILD_FORMAT_LIB} -eq 1 ] ; then
USE_STAROS=ON
fi
CMAKE_BUILD_TYPE=$BUILD_TYPE
echo "Build Backend: ${CMAKE_BUILD_TYPE}"
CMAKE_BUILD_DIR=${STARROCKS_HOME}/be/build_${CMAKE_BUILD_TYPE}
if [ "${WITH_GCOV}" = "ON" ]; then
CMAKE_BUILD_DIR=${STARROCKS_HOME}/be/build_${CMAKE_BUILD_TYPE}_gcov
fi
if [ ${BUILD_FORMAT_LIB} -eq 1 ] ; then
CMAKE_BUILD_DIR=${STARROCKS_HOME}/be/build_${CMAKE_BUILD_TYPE}_format-lib
fi
if [ ${CLEAN} -eq 1 ]; then
rm -rf $CMAKE_BUILD_DIR
rm -rf ${STARROCKS_HOME}/be/output/
fi
mkdir -p ${CMAKE_BUILD_DIR}
source ${STARROCKS_HOME}/bin/common.sh
cd ${CMAKE_BUILD_DIR}
if [ "${USE_STAROS}" == "ON" ]; then
if [ -z "$STARLET_INSTALL_DIR" ] ; then
# assume starlet_thirdparty is installed to ${STARROCKS_THIRDPARTY}/installed/starlet/
STARLET_INSTALL_DIR=${STARROCKS_THIRDPARTY}/installed/starlet
fi
export STARLET_INSTALL_DIR
fi
if [ "${OUTPUT_COMPILE_TIME}" == "ON" ]; then
rm -f ${ROOT}/compile_times.txt
CXX_COMPILER_LAUNCHER=${ROOT}/build-support/compile_time.sh
else
CXX_COMPILER_LAUNCHER=${CCACHE}
fi
if [ "${WITH_CLANG_TIDY}" == "ON" ];then
# this option cannot work with clang-14
WITH_COMPRESS=OFF
fi
${CMAKE_CMD} -G "${CMAKE_GENERATOR}" \
-DSTARROCKS_THIRDPARTY=${STARROCKS_THIRDPARTY} \
-DSTARROCKS_HOME=${STARROCKS_HOME} \
-DSTARLET_INSTALL_DIR=${STARLET_INSTALL_DIR} \
-DCMAKE_CXX_COMPILER_LAUNCHER=${CXX_COMPILER_LAUNCHER} \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DMAKE_TEST=OFF -DWITH_GCOV=${WITH_GCOV} \
-DUSE_AVX2=$USE_AVX2 -DUSE_AVX512=$USE_AVX512 \
-DUSE_SSE4_2=$USE_SSE4_2 -DUSE_BMI_2=$USE_BMI_2 \
-DJEMALLOC_DEBUG=$JEMALLOC_DEBUG \
-DENABLE_QUERY_DEBUG_TRACE=$ENABLE_QUERY_DEBUG_TRACE \
-DWITH_BENCH=${WITH_BENCH} \
-DWITH_CLANG_TIDY=${WITH_CLANG_TIDY} \
-DWITH_COMPRESS=${WITH_COMPRESS} \
-DWITH_STARCACHE=${WITH_STARCACHE} \
-DUSE_STAROS=${USE_STAROS} \
-DENABLE_FAULT_INJECTION=${ENABLE_FAULT_INJECTION} \
-DBUILD_BE=${BUILD_BE} \
-DWITH_TENANN=${WITH_TENANN} \
-DSTARROCKS_JIT_ENABLE=${ENABLE_JIT} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DBUILD_FORMAT_LIB=${BUILD_FORMAT_LIB} \
-DWITH_RELATIVE_SRC_PATH=${WITH_RELATIVE_SRC_PATH} \
..
time ${BUILD_SYSTEM} -j${PARALLEL}
if [ "${WITH_CLANG_TIDY}" == "ON" ];then
exit 0
fi
${BUILD_SYSTEM} install
# Build Java Extensions
if [ ${BUILD_JAVA_EXT} = "ON" ]; then
echo "Build Java Extensions"
cd ${STARROCKS_HOME}/java-extensions
if [ ${CLEAN} -eq 1 ]; then
${MVN_CMD} clean
fi
${MVN_CMD} package -DskipTests
cd ${STARROCKS_HOME}
else
echo "Skip Building Java Extensions"
fi
fi
cd ${STARROCKS_HOME}
# Assesmble FE modules
FE_MODULES=
if [ ${BUILD_FE} -eq 1 ] || [ ${BUILD_SPARK_DPP} -eq 1 ] || [ ${BUILD_HIVE_UDF} -eq 1 ]; then
if [ ${BUILD_SPARK_DPP} -eq 1 ]; then
FE_MODULES="fe-common,spark-dpp"
fi
if [ ${BUILD_HIVE_UDF} -eq 1 ]; then
FE_MODULES="fe-common,hive-udf"
fi
if [ ${BUILD_FE} -eq 1 ]; then
FE_MODULES="hive-udf,fe-common,spark-dpp,fe-core"
fi
fi
# Clean and build Frontend
if [ ${FE_MODULES}x != ""x ]; then
echo "Build Frontend Modules: $FE_MODULES"
cd ${STARROCKS_HOME}/fe
if [ ${CLEAN} -eq 1 ]; then
${MVN_CMD} clean
fi
${MVN_CMD} package -am -pl ${FE_MODULES} -DskipTests
cd ${STARROCKS_HOME}/java-extensions
${MVN_CMD} package -am -pl hadoop-ext -DskipTests
cd ${STARROCKS_HOME}
fi
# Clean and prepare output dir
STARROCKS_OUTPUT=${STARROCKS_HOME}/output/
mkdir -p ${STARROCKS_OUTPUT}
# Copy Frontend and Backend
if [ ${BUILD_FE} -eq 1 -o ${BUILD_SPARK_DPP} -eq 1 ]; then
if [ ${BUILD_FE} -eq 1 ]; then
install -d ${STARROCKS_OUTPUT}/fe/bin ${STARROCKS_OUTPUT}/fe/conf/ \
${STARROCKS_OUTPUT}/fe/webroot/ ${STARROCKS_OUTPUT}/fe/lib/ \
${STARROCKS_OUTPUT}/fe/spark-dpp/ ${STARROCKS_OUTPUT}/fe/hive-udf
cp -r -p ${STARROCKS_HOME}/bin/*_fe.sh ${STARROCKS_OUTPUT}/fe/bin/
cp -r -p ${STARROCKS_HOME}/bin/show_fe_version.sh ${STARROCKS_OUTPUT}/fe/bin/
cp -r -p ${STARROCKS_HOME}/bin/common.sh ${STARROCKS_OUTPUT}/fe/bin/
cp -r -p ${STARROCKS_HOME}/conf/fe.conf ${STARROCKS_OUTPUT}/fe/conf/
cp -r -p ${STARROCKS_HOME}/conf/udf_security.policy ${STARROCKS_OUTPUT}/fe/conf/
cp -r -p ${STARROCKS_HOME}/conf/hadoop_env.sh ${STARROCKS_OUTPUT}/fe/conf/
cp -r -p ${STARROCKS_HOME}/conf/core-site.xml ${STARROCKS_OUTPUT}/fe/conf/
rm -rf ${STARROCKS_OUTPUT}/fe/lib/*
cp -r -p ${STARROCKS_HOME}/fe/fe-core/target/lib/* ${STARROCKS_OUTPUT}/fe/lib/
cp -r -p ${STARROCKS_HOME}/fe/fe-core/target/starrocks-fe.jar ${STARROCKS_OUTPUT}/fe/lib/
cp -r -p ${STARROCKS_HOME}/java-extensions/hadoop-ext/target/starrocks-hadoop-ext.jar ${STARROCKS_OUTPUT}/fe/lib/
cp -r -p ${STARROCKS_HOME}/webroot/* ${STARROCKS_OUTPUT}/fe/webroot/
cp -r -p ${STARROCKS_HOME}/fe/spark-dpp/target/spark-dpp-*-jar-with-dependencies.jar ${STARROCKS_OUTPUT}/fe/spark-dpp/
cp -r -p ${STARROCKS_HOME}/fe/hive-udf/target/hive-udf-1.0.0.jar ${STARROCKS_OUTPUT}/fe/hive-udf/
cp -r -p ${STARROCKS_THIRDPARTY}/installed/async-profiler/* ${STARROCKS_OUTPUT}/fe/bin/
MSG="${MSG}${MSG_FE}"
elif [ ${BUILD_SPARK_DPP} -eq 1 ]; then
install -d ${STARROCKS_OUTPUT}/fe/spark-dpp/
rm -rf ${STARROCKS_OUTPUT}/fe/spark-dpp/*
cp -r -p ${STARROCKS_HOME}/fe/spark-dpp/target/spark-dpp-*-jar-with-dependencies.jar ${STARROCKS_OUTPUT}/fe/spark-dpp/
cp -r -p ${STARROCKS_HOME}/fe/hive-udf/target/hive-udf-1.0.0.jar ${STARROCKS_HOME}/fe/hive-udf/
MSG="${MSG}${MSG_DPP}"
fi
fi
if [ ${BUILD_FORMAT_LIB} -eq 1 ]; then
rm -rf ${STARROCKS_OUTPUT}/format-lib/*
mkdir -p ${STARROCKS_OUTPUT}/format-lib
cp -r ${STARROCKS_HOME}/be/output/format-lib/* ${STARROCKS_OUTPUT}/format-lib/
# format $BUILD_TYPE to lower case
ibuildtype=`echo ${BUILD_TYPE} | tr 'A-Z' 'a-z'`
if [ "${ibuildtype}" == "release" ] ; then
pushd ${STARROCKS_OUTPUT}/format-lib/ &>/dev/null
FORMAT_LIB=libstarrocks_format.so
FORMAT_LIB_DEBUGINFO=libstarrocks_format.debuginfo
echo "Split $FORMAT_LIB debug symbol to $FORMAT_LIB_DEBUGINFO ..."
# strip be binary
# if eu-strip is available, can replace following three lines into `eu-strip -g -f starrocks_be.debuginfo starrocks_be`
objcopy --only-keep-debug $FORMAT_LIB $FORMAT_LIB_DEBUGINFO
strip --strip-debug $FORMAT_LIB
objcopy --add-gnu-debuglink=$FORMAT_LIB_DEBUGINFO $FORMAT_LIB
popd &>/dev/null
fi
MSG="${MSG}${MSG_FORMAT_LIB}"
fi
if [ ${BUILD_BE} -eq 1 ]; then
rm -rf ${STARROCKS_OUTPUT}/be/lib/*
mkdir -p ${STARROCKS_OUTPUT}/be/lib/jni-packages
mkdir -p ${STARROCKS_OUTPUT}/be/lib/py-packages
install -d ${STARROCKS_OUTPUT}/be/bin \
${STARROCKS_OUTPUT}/be/conf \
${STARROCKS_OUTPUT}/be/lib/hadoop \
${STARROCKS_OUTPUT}/be/www \
cp -r -p ${STARROCKS_HOME}/be/output/bin/* ${STARROCKS_OUTPUT}/be/bin/
cp -r -p ${STARROCKS_HOME}/be/output/conf/be.conf ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/udf_security.policy ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/be_test.conf ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/cn.conf ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/hadoop_env.sh ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/log4j2.properties ${STARROCKS_OUTPUT}/be/conf/
cp -r -p ${STARROCKS_HOME}/be/output/conf/core-site.xml ${STARROCKS_OUTPUT}/be/conf/
if [ "${BUILD_TYPE}" == "ASAN" ]; then
cp -r -p ${STARROCKS_HOME}/be/output/conf/asan_suppressions.conf ${STARROCKS_OUTPUT}/be/conf/
fi
cp -r -p ${STARROCKS_HOME}/be/output/lib/starrocks_be ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/be/output/lib/libmockjvm.so ${STARROCKS_OUTPUT}/be/lib/libjvm.so
cp -r -p ${STARROCKS_THIRDPARTY}/installed/jemalloc/bin/jeprof ${STARROCKS_OUTPUT}/be/bin
# format $BUILD_TYPE to lower case
ibuildtype=`echo ${BUILD_TYPE} | tr 'A-Z' 'a-z'`
if [ "${ibuildtype}" == "release" ] ; then
pushd ${STARROCKS_OUTPUT}/be/lib/ &>/dev/null
BE_BIN=starrocks_be
BE_BIN_DEBUGINFO=starrocks_be.debuginfo
echo "Split $BE_BIN debug symbol to $BE_BIN_DEBUGINFO ..."
# strip be binary
# if eu-strip is available, can replace following three lines into `eu-strip -g -f starrocks_be.debuginfo starrocks_be`
objcopy --only-keep-debug $BE_BIN $BE_BIN_DEBUGINFO
strip --strip-debug $BE_BIN
objcopy --add-gnu-debuglink=$BE_BIN_DEBUGINFO $BE_BIN
popd &>/dev/null
fi
cp -r -p ${STARROCKS_HOME}/be/output/www/* ${STARROCKS_OUTPUT}/be/www/
if [ "${BUILD_JAVA_EXT}" == "ON" ]; then
cp -r -p ${STARROCKS_HOME}/java-extensions/jdbc-bridge/target/starrocks-jdbc-bridge-jar-with-dependencies.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/udf-extensions/target/udf-extensions-jar-with-dependencies.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/java-utils/target/starrocks-java-utils.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/jni-connector/target/starrocks-jni-connector.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/hudi-reader/target/hudi-reader-lib ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/java-extensions/hudi-reader/target/starrocks-hudi-reader.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/hudi-reader/target/starrocks-hudi-reader.jar ${STARROCKS_OUTPUT}/be/lib/hudi-reader-lib
cp -r -p ${STARROCKS_HOME}/java-extensions/odps-reader/target/odps-reader-lib ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/java-extensions/odps-reader/target/starrocks-odps-reader.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/odps-reader/target/starrocks-odps-reader.jar ${STARROCKS_OUTPUT}/be/lib/odps-reader-lib
cp -r -p ${STARROCKS_HOME}/java-extensions/iceberg-metadata-reader/target/iceberg-reader-lib ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/java-extensions/iceberg-metadata-reader/target/starrocks-iceberg-metadata-reader.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/iceberg-metadata-reader/target/starrocks-iceberg-metadata-reader.jar ${STARROCKS_OUTPUT}/be/lib/iceberg-reader-lib
cp -r -p ${STARROCKS_HOME}/java-extensions/common-runtime/target/common-runtime-lib ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/java-extensions/paimon-reader/target/paimon-reader-lib ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/java-extensions/paimon-reader/target/starrocks-paimon-reader.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/paimon-reader/target/starrocks-paimon-reader.jar ${STARROCKS_OUTPUT}/be/lib/paimon-reader-lib
cp -r -p ${STARROCKS_HOME}/java-extensions/kudu-reader/target/kudu-reader-lib ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/java-extensions/kudu-reader/target/starrocks-kudu-reader.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/kudu-reader/target/starrocks-kudu-reader.jar ${STARROCKS_OUTPUT}/be/lib/kudu-reader-lib
cp -r -p ${STARROCKS_HOME}/java-extensions/hadoop-ext/target/starrocks-hadoop-ext.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/hive-reader/target/hive-reader-lib ${STARROCKS_OUTPUT}/be/lib/
cp -r -p ${STARROCKS_HOME}/java-extensions/hive-reader/target/starrocks-hive-reader.jar ${STARROCKS_OUTPUT}/be/lib/jni-packages
cp -r -p ${STARROCKS_HOME}/java-extensions/hive-reader/target/starrocks-hive-reader.jar ${STARROCKS_OUTPUT}/be/lib/hive-reader-lib
fi
cp -r -p ${STARROCKS_THIRDPARTY}/installed/hadoop/share/hadoop/common ${STARROCKS_OUTPUT}/be/lib/hadoop/
cp -r -p ${STARROCKS_THIRDPARTY}/installed/hadoop/share/hadoop/hdfs ${STARROCKS_OUTPUT}/be/lib/hadoop/
cp -p ${STARROCKS_THIRDPARTY}/installed/hadoop/share/hadoop/tools/lib/hadoop-azure-* ${STARROCKS_OUTPUT}/be/lib/hadoop/hdfs
cp -p ${STARROCKS_THIRDPARTY}/installed/hadoop/share/hadoop/tools/lib/azure-* ${STARROCKS_OUTPUT}/be/lib/hadoop/hdfs
cp -p ${STARROCKS_THIRDPARTY}/installed/gcs_connector/*.jar ${STARROCKS_OUTPUT}/be/lib/hadoop/hdfs
cp -r -p ${STARROCKS_THIRDPARTY}/installed/hadoop/lib/native ${STARROCKS_OUTPUT}/be/lib/hadoop/
# remove zookeeper
rm -f ${STARROCKS_OUTPUT}/be/lib/hadoop/common/lib/zookeeper-3.8.3.jar
rm -f ${STARROCKS_OUTPUT}/be/lib/hadoop/hdfs/lib/zookeeper-3.8.3.jar
rm -f ${STARROCKS_OUTPUT}/be/lib/hadoop/common/lib/avro-1.9.2.jar
rm -f ${STARROCKS_OUTPUT}/be/lib/hadoop/hdfs/lib/avro-1.9.2.jar
cp -r -p ${STARROCKS_HOME}/be/extension/python-udf/src/flight_server.py ${STARROCKS_OUTPUT}/be/lib/py-packages
MSG="${MSG}${MSG_BE}"
fi
cp -r -p "${STARROCKS_HOME}/LICENSE.txt" "${STARROCKS_OUTPUT}/LICENSE.txt"
build-support/gen_notice.py "${STARROCKS_HOME}/licenses,${STARROCKS_HOME}/licenses-binary" "${STARROCKS_OUTPUT}/NOTICE.txt" all
endTime=$(date +%s)
totalTime=$((endTime - startTime))
echo "***************************************"
echo "Successfully build StarRocks ${MSG} ; StartTime:$(date -d @$startTime '+%Y-%m-%d %H:%M:%S'), EndTime:$(date -d @$endTime '+%Y-%m-%d %H:%M:%S'), TotalTime:${totalTime}s"
echo "***************************************"
if [[ ! -z ${STARROCKS_POST_BUILD_HOOK} ]]; then
eval ${STARROCKS_POST_BUILD_HOOK}
fi
exit 0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/superjay/starrocks.git
git@gitee.com:superjay/starrocks.git
superjay
starrocks
starrocks
main

搜索帮助