Skip to content

Commit 0176c78

Browse files
committed
Neutralize pybind11 auto-strip so symbols survive for splitting
pybind11_add_module() unconditionally attaches a POST_BUILD ${CMAKE_STRIP} step -- plain `strip` on Linux, i.e. --strip-all -- which runs before our own split and destroys both symtab and DWARF. Wheel builds therefore produced empty ~3KB .debug stubs (macOS was unaffected: `strip -x` keeps DWARF; Windows: CMAKE_STRIP unset). Stripping is now owned solely by the LBUG_SPLIT_DEBUG_SYMBOLS pipeline (in-build objcopy split, or host-side split_debug_symbols.py for wheels), both of which preserve .symtab so addresses stay mappable to function names.
1 parent af5052f commit 0176c78

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ project(_lbug LANGUAGES CXX C)
66
set(CMAKE_CXX_STANDARD 20)
77
set(LBUG_SOURCE_DIR "" CACHE PATH "Path to the Ladybug source tree used for pybind builds")
88

9+
option(LBUG_SPLIT_DEBUG_SYMBOLS "Split _lbug debug symbols into separate files at build time." ON)
10+
11+
# pybind11_add_module() auto-attaches a POST_BUILD ${CMAKE_STRIP} step, which
12+
# on Linux is a plain `strip` that removes both the symbol table and DWARF --
13+
# and it would run before our own split below, leaving nothing to separate
14+
# (this produced empty ~3KB .debug stubs in wheel builds). Neutralize it:
15+
# stripping is owned by the LBUG_SPLIT_DEBUG_SYMBOLS pipeline (in-build
16+
# objcopy split, or host-side split_debug_symbols.py for wheels), both of
17+
# which preserve .symtab so addresses stay mappable to function names.
18+
set(CMAKE_STRIP "")
19+
920
if(NOT TARGET pybind11::module)
1021
if(LBUG_SOURCE_DIR)
1122
add_subdirectory("${LBUG_SOURCE_DIR}/third_party/pybind11" "${CMAKE_BINARY_DIR}/third_party/pybind11" EXCLUDE_FROM_ALL)
@@ -87,7 +98,6 @@ target_link_options(_lbug PRIVATE
8798
# repair, and the split instead happens on the final repaired wheel via
8899
# scripts/pip-package/split_debug_symbols.py, which needs the debug info
89100
# to still be present in the shipped binary.
90-
option(LBUG_SPLIT_DEBUG_SYMBOLS "Split _lbug debug symbols into separate files at build time." ON)
91101
if(APPLE)
92102
# macOS: Extract symbols into a .dSYM bundle and strip the binary.
93103
find_program(DSYMUTIL dsymutil)

0 commit comments

Comments
 (0)