Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmake/FindZLIB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ if(NOT ZLIB_FOUND)
-fno-math-errno
-fwrapv)
endif()

# Disable LTO for zlib to work around GCC LTO linker plugin not
# properly rescanning this archive for transitive dependencies
if(HYDRA_COMPILER_GCC)
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Scope this LTO workaround to static zlib builds; as written it also disables LTO for shared builds that are not affected by the archive-rescan issue.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cmake/FindZLIB.cmake, line 70:

<comment>Scope this LTO workaround to static zlib builds; as written it also disables LTO for shared builds that are not affected by the archive-rescan issue.</comment>

<file context>
@@ -64,6 +64,12 @@ if(NOT ZLIB_FOUND)
+
+    # Disable LTO for zlib to work around GCC LTO linker plugin not
+    # properly rescanning this archive for transitive dependencies
+    if(HYDRA_COMPILER_GCC)
+      target_compile_options(zlib PRIVATE -fno-lto)
+    endif()
</file context>
Suggested change
if(HYDRA_COMPILER_GCC)
if(HYDRA_COMPILER_GCC AND NOT BUILD_SHARED_LIBS)
Fix with Cubic

target_compile_options(zlib PRIVATE -fno-lto)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the project enables LTO globally (e.g., via INTERPROCEDURAL_OPTIMIZATION/CMAKE_INTERPROCEDURAL_OPTIMIZATION), it’s worth double-checking that adding -fno-lto here reliably overrides any injected -flto so zlib is truly built non-LTO in those configurations. Otherwise the GCC LTO plugin issue this comment mentions could still reproduce.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

endif()
endif()

target_include_directories(zlib PUBLIC
Expand Down
Loading