Skip to content

Fix ubuntu symbol drop#109

Merged
chengcli merged 2 commits intomainfrom
cli/fix_ubuntu
Feb 5, 2026
Merged

Fix ubuntu symbol drop#109
chengcli merged 2 commits intomainfrom
cli/fix_ubuntu

Conversation

@chengcli
Copy link
Owner

@chengcli chengcli commented Feb 5, 2026

No description provided.

Cheng Li added 2 commits January 30, 2026 04:17
Copilot AI review requested due to automatic review settings February 5, 2026 19:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Ubuntu symbol drop issues by modifying linker behavior and library ordering. The changes aim to prevent the linker from dropping symbols from libraries that may appear unused but are actually needed at runtime.

Changes:

  • Modified library ordering in setup.py to place CUDA libraries last (as providers) and non-CUDA libraries first (as consumers)
  • Added --no-as-needed linker flags to Linux builds in both Python setup.py and CMake macros
  • Updated three CMake macros (test, problem, and CUDA test) to include the linker flag for Linux systems

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
setup.py Reordered library linking to place CUDA libraries last; added --no-as-needed/--as-needed linker flags for Linux builds (old code left commented)
cmake/macros/macro_setup_test.cmake Added --no-as-needed linker flag for Linux platforms to prevent symbol dropping in test builds
cmake/macros/macro_setup_problem.cmake Added --no-as-needed linker flag for Linux platforms to prevent symbol dropping in problem builds
cmake/macros/macro_setup_cuda_test.cmake Added --no-as-needed linker flag for Linux platforms to prevent symbol dropping in CUDA test builds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +25
#current = [item for item in library_names if item.startswith('snap')]
#other = [item for item in library_names if not item.startswith('snap')]
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out code should be removed rather than kept as comments. Leaving old code commented out reduces code maintainability and can cause confusion for future developers.

Suggested change
#current = [item for item in library_names if item.startswith('snap')]
#other = [item for item in library_names if not item.startswith('snap')]

Copilot uses AI. Check for mistakes.
Comment on lines +68 to +74
"-Wl,--no-as-needed",
"-Wl,-rpath,$ORIGIN/lib",
"-Wl,-rpath,$ORIGIN/../torch/lib",
"-Wl,-rpath,$ORIGIN/../pydisort/lib",
"-Wl,-rpath,$ORIGIN/../pyharp/lib",
"-Wl,-rpath,$ORIGIN/../kintera/lib",
"-Wl,--as-needed",
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --no-as-needed and --as-needed linker flags may not work as intended when placed in extra_link_args. The effectiveness of these flags depends on their position relative to the library link commands. In many build systems, extra_link_args are processed either before or after the libraries specified in the 'libraries' parameter, which could make these flags ineffective. The library ordering changes (lines 27-33) may be sufficient to fix the symbol drop issue without these flags. Consider testing whether these linker flags are actually necessary, or if the library reordering alone resolves the Ubuntu symbol drop problem.

Suggested change
"-Wl,--no-as-needed",
"-Wl,-rpath,$ORIGIN/lib",
"-Wl,-rpath,$ORIGIN/../torch/lib",
"-Wl,-rpath,$ORIGIN/../pydisort/lib",
"-Wl,-rpath,$ORIGIN/../pyharp/lib",
"-Wl,-rpath,$ORIGIN/../kintera/lib",
"-Wl,--as-needed",
"-Wl,-rpath,$ORIGIN/lib",
"-Wl,-rpath,$ORIGIN/../torch/lib",
"-Wl,-rpath,$ORIGIN/../pydisort/lib",
"-Wl,-rpath,$ORIGIN/../pyharp/lib",
"-Wl,-rpath,$ORIGIN/../kintera/lib",

Copilot uses AI. Check for mistakes.
@chengcli chengcli merged commit 8c65524 into main Feb 5, 2026
9 checks passed
@chengcli chengcli deleted the cli/fix_ubuntu branch February 5, 2026 20:20
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🎉 Released v1.2.7!

What's Changed

Full Changelog: v1.2.6...v1.2.7

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.

1 participant