Link sparsePython solvers against Python3::Module, not Python3::Python#4
Open
joecga4 wants to merge 1 commit into
Open
Link sparsePython solvers against Python3::Module, not Python3::Python#4joecga4 wants to merge 1 commit into
joecga4 wants to merge 1 commit into
Conversation
Development.Module is the correct find_package component for code that is loaded into an existing Python process: it provides the headers without linking libpython. With COMPONENTS Development / Python3::Python the build links whatever libpython find_package returns first; on systems where that is the static libpython3.x.a (e.g. Ubuntu with python3-dev), linking OpenSeesPy fails with relocation R_X86_64_32 against symbol ... in libpython3.12.a: recompile with -fPIC Extension modules must not link libpython anyway (the interpreter that imports them already provides the symbols), so Python3::Module is both the fix and the portable choice. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The two new sparsePython
CMakeLists.txtusefind_package(Python3 COMPONENTS Development)and linkPython3::Python. For code that gets loaded into a Python process the right component isDevelopment.Module/Python3::Module: it provides the headers without linking libpython.With
Python3::Python, the build links whatever libpythonfind_packagereturns first. On Ubuntu 24.04 (python3-dev) that is the staticlibpython3.12.a, and linking OpenSeesPy fails with:Extension modules should not link libpython at all (the importing interpreter already provides the symbols), so
Python3::Moduleis both the fix and the portable choice.Validation: OpenSees, OpenSeesPy, OpenSeesMP, OpenSeesSP and OpenSeesPyMP build clean on Ubuntu 24.04 (CMake + Conan 2); pytest suite 7/7;
EXAMPLES/verification/runVerificationSuite.tcl18/18.🤖 Generated with Claude Code