Skip to content

Commit

Permalink
[chore](third-party) Introduce libunwind (#21938)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz authored Jul 18, 2023
1 parent 24c0069 commit e0705f1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
27 changes: 27 additions & 0 deletions thirdparty/build-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,32 @@ build_jemalloc() {
mv "${TP_INSTALL_DIR}"/lib/libjemalloc.a "${TP_INSTALL_DIR}"/lib/libjemalloc_doris.a
}

# libunwind
build_libunwind() {
# https://github.com/libunwind/libunwind
# https://github.com/libunwind/libunwind/issues/189
# https://stackoverflow.com/questions/27842377/building-libunwind-for-mac
if [[ "${KERNEL}" != 'Darwin' ]]; then
check_if_source_exist "${LIBUNWIND_SOURCE}"
cd "${TP_SOURCE_DIR}/${LIBUNWIND_SOURCE}"

mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"

# We should enable optimizations (otherwise it will be too slow in debug)
# and disable sanitizers (otherwise infinite loop may happen)
# close exceptions and rtti can improve the operating efficiency of the program
# LIBUNWIND_NO_HEAP: https://reviews.llvm.org/D11897
# LIBUNWIND_IS_NATIVE_ONLY: https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160523/159802.html
# -nostdinc++ only required for gcc compilation
cflags='-std=c99 -D_LIBUNWIND_NO_HEAP=1 -D_DEBUG -D_LIBUNWIND_IS_NATIVE_ONLY -O3 -fno-exceptions -funwind-tables -fno-sanitize=all -nostdinc++ -fno-rtti'
CFLAGS="${cflags}" ../configure --prefix="${TP_INSTALL_DIR}"

make -j "${PARALLEL}"
make install
fi
}

# benchmark
build_benchmark() {
check_if_source_exist "${BENCHMARK_SOURCE}"
Expand Down Expand Up @@ -1590,6 +1616,7 @@ build_hadoop_libs() {

if [[ "${#packages[@]}" -eq 0 ]]; then
packages=(
libunwind
libunixodbc
openssl
libevent
Expand Down
7 changes: 7 additions & 0 deletions thirdparty/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ JEMALLOC_DORIS_NAME="jemalloc-5.3.0.tar.bz2"
JEMALLOC_DORIS_SOURCE="jemalloc-5.3.0"
JEMALLOC_DORIS_MD5SUM="09a8328574dab22a7df848eae6dbbf53"

# libunwind
LIBUNWIND_DOWNLOAD="http://download.savannah.nongnu.org/releases/libunwind/libunwind-1.6.2.tar.gz"
LIBUNWIND_NAME="libunwind-1.6.2.tar.gz"
LIBUNWIND_SOURCE="libunwind-1.6.2"
LIBUNWIND_MD5SUM="f625b6a98ac1976116c71708a73dc44a"

# cctz
CCTZ_DOWNLOAD="https://github.com/google/cctz/archive/v2.3.tar.gz"
CCTZ_NAME="cctz-2.3.tar.gz"
Expand Down Expand Up @@ -499,6 +505,7 @@ export TP_ARCHIVES=(
'ORC'
'JEMALLOC_ARROW'
'JEMALLOC_DORIS'
'LIBUNWIND'
'CCTZ'
'DATATABLES'
'BOOTSTRAP_TABLE_JS'
Expand Down

0 comments on commit e0705f1

Please sign in to comment.