This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new e0705f1149 [chore](third-party) Introduce libunwind (#21938)
e0705f1149 is described below

commit e0705f1149a5476adff1c9f5a3e74b445d444ec0
Author: Xinyi Zou <[email protected]>
AuthorDate: Wed Jul 19 01:55:26 2023 +0800

    [chore](third-party) Introduce libunwind (#21938)
---
 thirdparty/build-thirdparty.sh | 27 +++++++++++++++++++++++++++
 thirdparty/vars.sh             |  7 +++++++
 2 files changed, 34 insertions(+)

diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 1fd8f0f7f7..2c7f75d6a1 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -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}"
@@ -1590,6 +1616,7 @@ build_hadoop_libs() {
 
 if [[ "${#packages[@]}" -eq 0 ]]; then
     packages=(
+        libunwind
         libunixodbc
         openssl
         libevent
diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh
index bc7a53a37e..f10c56fa9e 100644
--- a/thirdparty/vars.sh
+++ b/thirdparty/vars.sh
@@ -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"
@@ -499,6 +505,7 @@ export TP_ARCHIVES=(
     'ORC'
     'JEMALLOC_ARROW'
     'JEMALLOC_DORIS'
+    'LIBUNWIND'
     'CCTZ'
     'DATATABLES'
     'BOOTSTRAP_TABLE_JS'


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to