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 08c5e0b1e3 [chore](deps) strip debug info of thirdparty dependencies 
(#12284)
08c5e0b1e3 is described below

commit 08c5e0b1e3aefc4755d44d460bb699152dce449a
Author: Mingyu Chen <morningman....@gmail.com>
AuthorDate: Fri Sep 2 15:43:29 2022 +0800

    [chore](deps) strip debug info of thirdparty dependencies (#12284)
    
    Strip debug info of most of thridparty dependencies' static lib.
    If can significantly reduce the size of thirdparty libs: 3.4G -> 1.6G
    And the doris_be binary size will be reduced: 1.5G -> 868M (clang build)
    And after compress, the BE binary is only 195M with debug info!
---
 thirdparty/build-thirdparty.sh | 51 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh
index 71092f21f5..a9ceb3820c 100755
--- a/thirdparty/build-thirdparty.sh
+++ b/thirdparty/build-thirdparty.sh
@@ -278,6 +278,7 @@ build_libevent() {
     "${BUILD_SYSTEM}" install
 
     remove_all_dylib
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libevent.a
 }
 
 build_openssl() {
@@ -339,6 +340,8 @@ build_thrift() {
 
     make -j "${PARALLEL}"
     make install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libthrift.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libthriftnb.a
 }
 
 # protobuf
@@ -383,6 +386,8 @@ build_protobuf() {
 
     make -j "${PARALLEL}"
     make install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libprotobuf.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libprotoc.a
 }
 
 # gflags
@@ -418,6 +423,7 @@ build_glog() {
 
     make -j "${PARALLEL}"
     make install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libglog.a
 }
 
 # gtest
@@ -435,6 +441,7 @@ build_gtest() {
 
     "${BUILD_SYSTEM}" -j "${PARALLEL}"
     "${BUILD_SYSTEM}" install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libgtest.a
 }
 
 # rapidjson
@@ -545,6 +552,7 @@ build_zstd() {
         -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_SHARED=OFF 
-DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" ..
 
     "${BUILD_SYSTEM}" -j "${PARALLEL}" install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libzstd.a
 }
 
 # bzip
@@ -566,6 +574,7 @@ build_lzo2() {
 
     make -j "${PARALLEL}"
     make install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/liblzo2.a
 }
 
 # curl
@@ -588,6 +597,7 @@ build_curl() {
 
     make curl_LDFLAGS=-all-static -j "${PARALLEL}"
     make curl_LDFLAGS=-all-static install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libcurl.a
 }
 
 # re2
@@ -597,6 +607,7 @@ build_re2() {
 
     "${CMAKE_CMD}" -DCMAKE_BUILD_TYPE=Release -G "${GENERATOR}" 
-DBUILD_SHARED_LIBS=0 -DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}"
     "${BUILD_SYSTEM}" -j "${PARALLEL}" install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libre2.a
 }
 
 # hyperscan
@@ -623,6 +634,7 @@ build_hyperscan() {
     "${CMAKE_CMD}" -G "${GENERATOR}" -DBUILD_SHARED_LIBS=0 \
         -DBOOST_ROOT="${BOOST_SOURCE}" 
-DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" -DBUILD_EXAMPLES=OFF ..
     "${BUILD_SYSTEM}" -j "${PARALLEL}" install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libhs.a
 }
 
 # boost
@@ -685,6 +697,7 @@ build_mysql() {
     # copy libmysqlclient.a
     cp libmysql/libmysqlclient.a ../../../installed/lib/
     echo "mysql client lib is installed."
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libmysqlclient.a
 }
 
 #leveldb
@@ -700,6 +713,7 @@ build_leveldb() {
     CXXFLAGS="-fPIC" "${CMAKE_CMD}" -G "${GENERATOR}" 
-DCMAKE_INSTALL_PREFIX="${TP_INSTALL_DIR}" -DLEVELDB_BUILD_BENCHMARKS=OFF \
         -DLEVELDB_BUILD_TESTS=OFF ..
     "${BUILD_SYSTEM}" -j "${PARALLEL}" install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libleveldb.a
 }
 
 # brpc
@@ -730,6 +744,7 @@ build_brpc() {
     "${BUILD_SYSTEM}" install
 
     remove_all_dylib
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libbrpc.a
 }
 
 # rocksdb
@@ -752,6 +767,7 @@ build_rocksdb() {
         PORTABLE=1 make USE_RTTI=1 -j "${PARALLEL}" static_lib
     cp librocksdb.a ../../installed/lib/librocksdb.a
     cp -r include/rocksdb ../../installed/include/
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/librocksdb.a
 }
 
 # cyrus_sasl
@@ -786,6 +802,8 @@ build_librdkafka() {
     make install
 
     remove_all_dylib
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/librdkafka.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/librdkafka++.a
 }
 
 # libunixodbc
@@ -895,6 +913,9 @@ build_arrow() {
     cp -rf ./brotli_ep/src/brotli_ep-install/lib/libbrotlienc-static.a 
"${TP_INSTALL_DIR}/lib64/libbrotlienc.a"
     cp -rf ./brotli_ep/src/brotli_ep-install/lib/libbrotlidec-static.a 
"${TP_INSTALL_DIR}/lib64/libbrotlidec.a"
     cp -rf ./brotli_ep/src/brotli_ep-install/lib/libbrotlicommon-static.a 
"${TP_INSTALL_DIR}/lib64/libbrotlicommon.a"
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libarrow.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libjemalloc.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libparquet.a
 }
 
 # s2
@@ -927,6 +948,7 @@ build_s2() {
 
     "${BUILD_SYSTEM}" -j "${PARALLEL}"
     "${BUILD_SYSTEM}" install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libs2.a
 }
 
 # bitshuffle
@@ -1074,6 +1096,7 @@ build_orc() {
 
     "${BUILD_SYSTEM}" -j "${PARALLEL}"
     "${BUILD_SYSTEM}" install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/liborc.a
 }
 
 #cctz
@@ -1133,6 +1156,22 @@ build_aws_sdk() {
 
     "${BUILD_SYSTEM}" -j "${PARALLEL}"
     "${BUILD_SYSTEM}" install
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libaws-cpp-sdk-s3-crt.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-cpp-sdk-s3.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-cpp-sdk-core.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libs2n.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-crt-cpp.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-c-http.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-c-common.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-c-auth.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-c-io.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-c-mqtt.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-c-s3.a
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libaws-c-event-stream.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-c-cal.a
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libaws-cpp-sdk-transfer.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-checksums.a
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libaws-c-compression.a
 }
 
 # lzma
@@ -1156,6 +1195,7 @@ build_lzma() {
 
     make -j "${PARALLEL}"
     make install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/liblzma.a
 }
 
 # xml2
@@ -1182,6 +1222,7 @@ build_xml2() {
 
     make -j "${PARALLEL}"
     make install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libxml2.a
 }
 
 # idn
@@ -1253,6 +1294,7 @@ build_hdfs3() {
 
     make CXXFLAGS="${libhdfs_cxx17}" -j "${PARALLEL}"
     make install
+    strip --strip-debug --strip-unneeded "${TP_LIB_DIR}"/libhdfs3.a
 }
 
 # benchmark
@@ -1276,7 +1318,7 @@ build_benchmark() {
 
     mkdir -p "${TP_INCLUDE_DIR}/benchmark"
     cp "${TP_SOURCE_DIR}/${BENCHMARK_SOURCE}/include/benchmark/benchmark.h" 
"${TP_INCLUDE_DIR}/benchmark/"
-    cp "${TP_SOURCE_DIR}/${BENCHMARK_SOURCE}/build/src/libbenchmark.a" 
"${TP_LIB_DIR}/"
+    cp "${TP_SOURCE_DIR}/${BENCHMARK_SOURCE}/build/src/libbenchmark.a" 
"${TP_LIB_DIR}"
 }
 
 # simdjson
@@ -1324,6 +1366,13 @@ build_opentelemetry() {
 
     "${BUILD_SYSTEM}" -j "${PARALLEL}"
     "${BUILD_SYSTEM}" install
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libopentelemetry_exporter_zipkin_trace.a
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libopentelemetry_trace.a
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libopentelemetry_proto.a
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libopentelemetry_resources.a
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libopentelemetry_exporter_ostream_span.a
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libopentelemetry_http_client_curl.a
+    strip --strip-debug --strip-unneeded 
"${TP_LIB_DIR}"/libopentelemetry_exporter_otlp_http_client.a
 }
 
 # sse2neon


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to