From 668124e0fd05d44b36ec8adc9d0d66a684243860 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Wed, 29 Apr 2026 15:14:11 -0400 Subject: [PATCH] [build] Compress shared object debug info (#8835) This saves a huge amount of space when they're unzipped for robot projects, while not increasing artifact size. --- cmake/modules/CompileWarnings.cmake | 1 + shared/bazel/compiler_flags/linux_flags.rc | 2 +- shared/config.gradle | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/modules/CompileWarnings.cmake b/cmake/modules/CompileWarnings.cmake index e7ea1b533a..7cd0aabdcf 100644 --- a/cmake/modules/CompileWarnings.cmake +++ b/cmake/modules/CompileWarnings.cmake @@ -63,5 +63,6 @@ macro(wpilib_target_warnings target) AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" ) target_compile_options(${target} PRIVATE -gz=zlib) + target_link_options(${target} PRIVATE -gz=zlib) endif() endmacro() diff --git a/shared/bazel/compiler_flags/linux_flags.rc b/shared/bazel/compiler_flags/linux_flags.rc index 6e24041dcf..39df029643 100644 --- a/shared/bazel/compiler_flags/linux_flags.rc +++ b/shared/bazel/compiler_flags/linux_flags.rc @@ -13,7 +13,7 @@ common:linux --repo_env=BAZEL_CXXOPTS="-std=c++23:-Wformat=2:-pedantic:-Wno-psab common:linux --repo_env=BAZEL_CONLYOPTS="-Wformat=2:-pedantic:-Wno-psabi:-Wno-unused-parameter:-fPIC:-pthread" # Linker -common:linux --repo_env=BAZEL_LINKOPTS="-rdynamic:-pthread:-ldl:-latomic:-Wl,-rpath,'$ORIGIN'" +common:linux --repo_env=BAZEL_LINKOPTS="-rdynamic:-pthread:-ldl:-latomic:-Wl,-rpath,'$ORIGIN':-gz=zlib" # Cleanup build output for tools build:linux --host_cxxopt=-Wno-missing-field-initializers diff --git a/shared/config.gradle b/shared/config.gradle index 25caff0765..0e83e6a846 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -46,6 +46,7 @@ nativeUtils.platformConfigs.each { if (it.name.contains('linux')) { // Compress debug info on Linux it.cppCompiler.debugArgs.add("-gz=zlib") + it.linker.args.add("-gz=zlib") // Make warning in OpenCV 4.10 from GCC 15 not an error it.cppCompiler.args.add("-Wno-error=overloaded-virtual") // Make warning from Google Benchmark not an error