Skip to content

Link sparsePython solvers against Python3::Module, not Python3::Python#4

Open
joecga4 wants to merge 1 commit into
aschellenberg74:masterfrom
joecga4:fix/sparsepython-python3-module
Open

Link sparsePython solvers against Python3::Module, not Python3::Python#4
joecga4 wants to merge 1 commit into
aschellenberg74:masterfrom
joecga4:fix/sparsepython-python3-module

Conversation

@joecga4

@joecga4 joecga4 commented Jul 6, 2026

Copy link
Copy Markdown

The two new sparsePython CMakeLists.txt use find_package(Python3 COMPONENTS Development) and link Python3::Python. For code that gets loaded into a Python process the right component is Development.Module / Python3::Module: it provides the headers without linking libpython.

With Python3::Python, the build links whatever libpython find_package returns first. On Ubuntu 24.04 (python3-dev) that is the static libpython3.12.a, and linking OpenSeesPy fails with:

relocation R_X86_64_32 against symbol ... in libpython3.12.a: recompile with -fPIC

Extension modules should not link libpython at all (the importing interpreter already provides the symbols), so Python3::Module is 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.tcl 18/18.

🤖 Generated with Claude Code

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>
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