Skip to content

Commit af5052f

Browse files
committed
Gate build-time symbol split behind LBUG_SPLIT_DEBUG_SYMBOLS
Wheel builds set -DLBUG_SPLIT_DEBUG_SYMBOLS=OFF via setup.py: raw .debug/dSYM artifacts packaged inside the wheel break auditwheel repair, and the split instead happens on the final repaired wheel (where the debug info must still be present). Local builds keep the previous split-at-build-time behavior (default ON).
1 parent b8b81a5 commit af5052f

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,25 @@ target_link_options(_lbug PRIVATE
8181
)
8282

8383
# --- Cross-Platform Symbol Separation ---
84+
# NOTE: build-time splitting must be OFF for wheel builds
85+
# (-DLBUG_SPLIT_DEBUG_SYMBOLS=OFF, set by scripts/pip-package/setup.py).
86+
# Raw .debug/dSYM artifacts packaged inside the wheel break auditwheel
87+
# repair, and the split instead happens on the final repaired wheel via
88+
# scripts/pip-package/split_debug_symbols.py, which needs the debug info
89+
# 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)
8491
if(APPLE)
8592
# macOS: Extract symbols into a .dSYM bundle and strip the binary.
8693
find_program(DSYMUTIL dsymutil)
8794
find_program(STRIP strip)
88-
if(DSYMUTIL AND STRIP)
95+
if(DSYMUTIL AND STRIP AND LBUG_SPLIT_DEBUG_SYMBOLS)
8996
add_custom_command(TARGET _lbug POST_BUILD
9097
COMMAND ${DSYMUTIL} $<TARGET_FILE:_lbug> -o $<TARGET_FILE:_lbug>.dSYM
9198
COMMAND ${STRIP} -S $<TARGET_FILE:_lbug>
9299
COMMENT "macOS: Creating dSYM bundle and stripping debug symbols..."
93100
)
94101
else()
95-
message(STATUS "dsymutil/strip not found; _lbug debug symbols will not be split.")
102+
message(STATUS "_lbug debug symbols will not be split at build time.")
96103
endif()
97104
elseif(WIN32)
98105
# Windows: MSVC natively outputs a separate .pdb file if /DEBUG is set.
@@ -111,7 +118,7 @@ elseif(UNIX)
111118
# Linux: Use GNU objcopy to split symbols. The .debug file travels next to
112119
# the extension so wheel builds can publish it as a separate artifact.
113120
find_program(OBJCOPY objcopy)
114-
if(OBJCOPY)
121+
if(OBJCOPY AND LBUG_SPLIT_DEBUG_SYMBOLS)
115122
add_custom_command(TARGET _lbug POST_BUILD
116123
COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:_lbug> _lbug.debug
117124
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:_lbug>
@@ -123,7 +130,7 @@ elseif(UNIX)
123130
COMMENT "Linux: Splitting debug symbols into .debug file..."
124131
)
125132
else()
126-
message(STATUS "objcopy not found; _lbug debug symbols will not be split.")
133+
message(STATUS "_lbug debug symbols will not be split at build time.")
127134
endif()
128135
endif()
129136

0 commit comments

Comments
 (0)