You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2020/08/12 20:26:56 UTC
[impala] 02/02: IMPALA-10029: Strip debug symbols from
libkudu_client and libstdc++ binaries
This is an automated email from the ASF dual-hosted git repository.
stakiar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 3e77650dcf56c80ac2a200eaba5c8e12b9ce1b89
Author: Sahil Takiar <ta...@gmail.com>
AuthorDate: Thu Jul 30 16:43:23 2020 -0700
IMPALA-10029: Strip debug symbols from libkudu_client and libstdc++ binaries
Strip debug symbols from libkudu_client.so and libstdc++.so. The same
technique used to strip debug symbols from impalad binaries is used.
This decreases the Docker image sizes by about 100 MB.
Test:
* Ran Dockerized tests
Change-Id: I61fdf47041bd96248ecb48ae57dde143de2da294
Reviewed-on: http://gerrit.cloudera.org:8080/16263
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
docker/setup_build_context.py | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/docker/setup_build_context.py b/docker/setup_build_context.py
index 9744a0e..24daf32 100755
--- a/docker/setup_build_context.py
+++ b/docker/setup_build_context.py
@@ -69,6 +69,11 @@ def symlink_file_into_dir(src_file, dst_dir):
os.symlink(src_file, os.path.join(dst_dir, os.path.basename(src_file)))
+def strip_debug_symbols(src_file, dst_file):
+ """Strips debug symbols from the given src_file and writes the output to the given
+ dst_file."""
+ check_call([STRIP, "--strip-debug", src_file, "-o", dst_file])
+
# Impala binaries and native dependencies.
# Strip debug symbols from release build to reduce image size. Keep them for
@@ -77,14 +82,30 @@ IMPALAD_BINARY = os.path.join(IMPALA_HOME, "be/build", BUILD_TYPE, "service/impa
if args.debug_build:
symlink_file_into_dir(IMPALAD_BINARY, BIN_DIR)
else:
- check_call([STRIP, "--strip-debug", IMPALAD_BINARY,
- "-o", os.path.join(BIN_DIR, "impalad")])
-for lib in ["libstdc++", "libgcc"]:
- for so in glob.glob(os.path.join(GCC_HOME, "lib64/{0}*.so*".format(lib))):
- symlink_file_into_dir(so, LIB_DIR)
-
-for so in glob.glob(os.path.join(KUDU_LIB_DIR, "libkudu_client.so*")):
- symlink_file_into_dir(so, LIB_DIR)
+ strip_debug_symbols(IMPALAD_BINARY, os.path.join(BIN_DIR, "impalad"))
+
+# Add libstc++ binaries to LIB_DIR. Strip debug symbols for release builds.
+for libstdcpp_so in glob.glob(os.path.join(
+ GCC_HOME, "lib64/{0}*.so*".format("libstdc++"))):
+ # Ignore 'libstdc++.so.*-gdb.py'.
+ if not os.path.basename(libstdcpp_so).endswith(".py"):
+ if args.debug_build:
+ symlink_file_into_dir(libstdcpp_so, LIB_DIR)
+ else:
+ strip_debug_symbols(libstdcpp_so,
+ os.path.join(LIB_DIR, os.path.basename(libstdcpp_so)))
+
+# Add libgcc binaries to LIB_DIR.
+for libgcc_so in glob.glob(os.path.join(GCC_HOME, "lib64/{0}*.so*".format("libgcc_s"))):
+ symlink_file_into_dir(libgcc_so, LIB_DIR)
+
+# Add libkudu_client binaries to LIB_DIR. Strip debug symbols for release builds.
+for kudu_client_so in glob.glob(os.path.join(KUDU_LIB_DIR, "libkudu_client.so*")):
+ if args.debug_build:
+ symlink_file_into_dir(kudu_client_so, LIB_DIR)
+ else:
+ strip_debug_symbols(kudu_client_so,
+ os.path.join(LIB_DIR, os.path.basename(kudu_client_so)))
# Impala dependencies.
dep_classpath = file(os.path.join(IMPALA_HOME, "fe/target/build-classpath.txt")).read()