You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2019/07/03 17:42:43 UTC

[impala] 03/05: build: use thin static archives

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

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

commit 78c55230288f8874bcd16454eb3c55277211719a
Author: Todd Lipcon <to...@apache.org>
AuthorDate: Mon Jul 1 16:54:37 2019 -0700

    build: use thin static archives
    
    This enables thin static archives for our internal libraries during the
    build. This makes linking much faster since the static archives just
    point to object files instead of copying them.
    
    This reduces the size of intermediate '.a' files for my debug build from
    about 1.4GB to 58MB.
    
    Incremental rebuilds are slightly sped up, though maybe in the realm of
    noise (likely the performance improvement depends on how much RAM is
    available for buffer caching the IO):
    
    Without patch incremental build of catalogd after modifying CatalogObjects.thrift:
    real    0m53.433s
    user    7m6.400s
    sys     1m21.610s
    
    With patch:
    real    0m44.772s
    user    7m6.632s
    sys     1m16.870s
    
    Change-Id: I3b54b5be8658c951914758c406cca55d4cc1756e
    Reviewed-on: http://gerrit.cloudera.org:8080/13775
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 CMakeLists.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d72430..e60e811 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -398,6 +398,15 @@ endif()
 find_package(kuduClient REQUIRED NO_DEFAULT_PATH)
 include_directories(SYSTEM ${KUDU_CLIENT_INCLUDE_DIR})
 
+# Use "thin archives" for our static libraries. We only use static libraries
+# internal to our own build, so thin ones are just as good and much smaller.
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcT <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcT <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qT <TARGET> <LINK_FLAGS> <OBJECTS>")
+  set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qT <TARGET> <LINK_FLAGS> <OBJECTS>")
+endif()
+
 # compile these subdirs using their own CMakeLists.txt
 add_subdirectory(common/function-registry)
 add_subdirectory(common/thrift)