Improve Linux/macOS debug symbol setup#860
Conversation
… setup where the release library binary is small but the symbols are available for debugging issues.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR makes Linux and macOS RelWithDebInfo builds produce split debug symbols, mirroring the existing Windows behavior (small shipped binary + separately available symbols). A new CMake module wires up POST_BUILD symbol extraction, and the Linux/macOS pipeline build steps stage the resulting companion files as artifacts.
Changes:
- Add
cmake/SplitDebugSymbols.cmaketo split symbols forRelWithDebInfo: Linux usesobjcopy --only-keep-debug+strip --strip-debug+--add-gnu-debuglink; macOS usesdsymutilthenstrip -S. - Include the new module from
sdk_v2/cpp/CMakeLists.txt. - Stage
libfoundry_local.so.dbg(Linux) andlibfoundry_local.dylib.dSYM(macOS) into the native build artifact.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
sdk_v2/cpp/cmake/SplitDebugSymbols.cmake |
New CMake module performing platform-appropriate debug-symbol splitting for RelWithDebInfo only. |
sdk_v2/cpp/CMakeLists.txt |
Includes the new module after the shared/interface targets are defined. |
.pipelines/v2/templates/steps-build-linux.yml |
Stages the .dbg companion into the shared native artifact. |
.pipelines/v2/templates/steps-build-macos.yml |
Stages the .dSYM bundle into the shared native artifact. |
Notable concern: the .dbg/.dSYM are staged into the same cpp-native-<rid> artifact that the Python wheel build copies wholesale, so the macOS .dSYM bundle collides with the real dylib in the wheel and the Linux .dbg bloats the wheel — contrary to the PR's "small shipped binary" goal.
| dsym="$src/libfoundry_local.dylib.dSYM" | ||
| if [ -d "$dsym" ]; then | ||
| cp -r "$dsym" "$dst/" | ||
| echo " staged libfoundry_local.dylib.dSYM" |
|
Do we want to include these symbols/debug files in the tgz files of the cpp sdk? Will need some changes under |
I think so. We don't want the symbols in the packages, but we do want them to be available for direct download. We also need to publish the pdb to the windows symbol server I believe. Can you add the required changes to this branch or point me to what needs updating? |
Separate/create symbols file for linux and macos to replicate Windows setup where the release library binary is small but the symbols are available for debugging issues.
Linux — three-step GNU toolchain sequence:
objcopy --only-keep-debug→libfoundry_local.so.dbg(DWARF only)strip --strip-debug→ removes DWARF sections from the.so, keeps the exported symbol table (needed fordlopen)objcopy --add-gnu-debuglink=libfoundry_local.so.dbg→ embeds the filename + CRC into a.gnu_debuglinksection. GDB/LLDB read this and auto-discover the.dbgfile when it's in the same directory. Zero developer friction.macOS — two-step Apple toolchain sequence (order matters):
dsymutilfirst — harvests DWARF from all.ofiles (still present at POST_BUILD time) intolibfoundry_local.dylib.dSYM/— a self-contained relocatable bundlestrip -Ssecond — removes the now-redundant N_OSO stab entries. LLDB/Xcode find the.dSYMautomatically by UUID when it sits alongside the.dylib.