Fix sanitizer link propagation for NPDetPlugins in clang CI builds#53
Closed
Copilot wants to merge 2 commits into
Closed
Fix sanitizer link propagation for NPDetPlugins in clang CI builds#53Copilot wants to merge 2 commits into
NPDetPlugins in clang CI builds#53Copilot wants to merge 2 commits into
Conversation
Agent-Logs-Url: https://github.com/eic/npsim/sessions/cb177609-46c4-4616-a786-af46326ddc0f Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ASan link failure for NPDetPlugins in GitHub Actions
Fix sanitizer link propagation for May 17, 2026
NPDetPlugins in clang CI builds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
linux-eic-shellclang sanitizer builds were failing to linklibNPDetPlugins.sowith unresolved ASan symbols (__asan_report_store4/8). The failure was isolated to the plugin target created bydd4hep_add_plugin(...), where sanitizer link flags were not reliably applied.Targeted plugin-level sanitizer linking
src/plugins/CMakeLists.txtto add explicit target link options onNPDetPluginswhen sanitizers are enabled.USE_ASAN→-fsanitize=addressUSE_UBSAN→-fsanitize=undefinedScope
NPDetPlugins, avoiding broader CMake behavior changes while preserving sanitizer coverage.Original prompt
Fix pull request #50 in repository
eic/npsimby addressing the failing GitHub Actions build job in workflow.github/workflows/linux-eic-shell.ymlfor commite4be85c2a80e7f6f6c244e448bab5ae48a00045e.Observed failure:
lib/libNPDetPlugins.sofails with undefined ASan symbols:__asan_report_store4__asan_report_store8src/plugins/CMakeLists.txt, which definesdd4hep_add_plugin(NPDetPlugins ...).Relevant files already inspected:
.github/workflows/linux-eic-shell.ymlsrc/plugins/CMakeLists.txtLikely root cause:
dd4hep_add_plugin(...)is not receiving the necessary sanitizer link options/runtime propagation under clang, causing ASan link failure for the shared plugin target.Requested change:
NPDetPluginsreceives explicit sanitizer link options (and compile options if needed) whenUSE_ASANand/orUSE_UBSANare enabled, so the clang sanitizer build links successfully.Please create a commit on the PR branch with the fix and open/update the pull request accordingly.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The failure is in the clang++ ASAN/UBSAN build of the
buildjob in.github/workflows/linux-eic-shell.yml, where sanitizers are enabled for both compilers:-DUSE_ASAN=ON-DUSE_UBSAN=ONThe actual error occurs while linking
NPDetPluginsfromsrc/plugins/CMakeLists.txt:lib/libNPDetPlugins.soundefined reference to '__asan_report_store4'undefined reference to '__asan_report_store8'Root cause
This is a sanitizer link mismatch: Clang is pulling in the static ASan runtime (
libclang_rt.asan_static-x86_64.a), but the final plugin link is missing the full ASan runtime needed to resolve those symbols.Because the failure is isolated to the plugin target, the most likely issue is that the sanitizer compile options are being applied, but the corresponding link options/libraries are not propagating to
dd4hep_add_plugin(...).Solution
Make sure the plugin target links with sanitizer flags explicitly when sanitizers are enabled.
Recommended patch
Update
src/plugins/CMakeLists.txtto add sanitizer link options directly toNPDetPlugins:Why this should fix it
dd4hep_add_plugin(...)creates a shared library target, and shared-library/plugin targets often do not inherit sanitizer link flags reliably from global settings or parent targets. Addingtarget_link_options(... -fsanitize=address)ensures Clang links the correct ASan runtime forlibNPDetPlugins.so.If you want the smallest possible change
If ASAN/UBSAN are already applied globally at compile time elsewhere, this may be enough:
Less ideal workaround
If the project does not need sani...
This pull request was created from Copilot chat.