Skip to content

Strip debug symbols from release builds of loadable extension - #123

Merged
myrrc merged 2 commits into
mainfrom
claude/duckdb-extension-size-dkfkri
Sep 8, 2026
Merged

myrrc merged 2 commits into
mainfrom
claude/duckdb-extension-size-dkfkri

Conversation

@joseph-isaacs

Copy link
Copy Markdown
Contributor

Summary

This change optimizes the size of release builds of the loadable extension by stripping debug symbols and the static symbol table, reducing the distributed binary to approximately one-fifth of its original size.

Key Changes

  • Added conditional stripping of symbols for Release builds of the loadable extension
  • On macOS (Apple): Uses the -x linker flag to strip local symbols
  • On Linux and other Unix-like systems: Uses --strip-all linker flag to remove all symbols
  • Windows builds are excluded from stripping (no change in behavior)

Implementation Details

  • The stripping only applies when CMAKE_BUILD_TYPE is set to "Release"
  • DuckDB resolves extension entry points through the dynamic symbol table, which is preserved during stripping
  • This optimization significantly reduces the size of the distributed binary without affecting functionality

https://claude.ai/code/session_01WjsJd1n9cLQJTuiW6Lpno1

The distributed extension binary shipped with its full static symbol
table and debug sections, which together are roughly a fifth of its
size. DuckDB resolves the extension entry points through the dynamic
symbol table, which stripping keeps, so drop the rest at link time for
release builds.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjsJd1n9cLQJTuiW6Lpno1
@myrrc
myrrc marked this pull request as ready for review September 8, 2026 12:56
@myrrc
myrrc enabled auto-merge (squash) September 8, 2026 12:56
@myrrc
myrrc disabled auto-merge September 8, 2026 13:03
Stripping stays the default for release builds, but the option lets a
developer relink with the symbol table intact so crash backtraces keep
function names.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjsJd1n9cLQJTuiW6Lpno1
@myrrc
myrrc enabled auto-merge (squash) September 8, 2026 13:30
@myrrc
myrrc merged commit 2aaba5f into main Sep 8, 2026
14 checks passed
@myrrc
myrrc deleted the claude/duckdb-extension-size-dkfkri branch September 8, 2026 13:44
github-actions Bot pushed a commit that referenced this pull request Sep 8, 2026
* Strip the loadable extension in release builds

The distributed extension binary shipped with its full static symbol
table and debug sections, which together are roughly a fifth of its
size. DuckDB resolves the extension entry points through the dynamic
symbol table, which stripping keeps, so drop the rest at link time for
release builds.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjsJd1n9cLQJTuiW6Lpno1

* Add VORTEX_STRIP_EXTENSION option to keep symbols when debugging

Stripping stays the default for release builds, but the option lets a
developer relink with the symbol table intact so crash backtraces keep
function names.

Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WjsJd1n9cLQJTuiW6Lpno1

---------

Signed-off-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit 2aaba5f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants