【Super Point】Bianbu 4.0.1: libspine_gemm_bridge.so links against system Python but fails to initialize due to an incorrect Python version dependency

System Version / Image

Item Information
System Bianbu 4.0.1 (Resolute Raccoon)
Kernel 6.18.3-generic #1.0.2.4 SMP PREEMPT_DYNAMIC
Architecture RISC-V 64 (rv64gc)
Related package spacemit-tcm (includes libspine_gemm_bridge.so)
Python version 3.14

Use Case or Test Objective

Use ONNX Runtime + SpacemiT EP to accelerate AI inference. libspine_gemm_bridge.so is part of the spacemit-tcm package and provides a bridge for GEMM (general matrix multiplication) acceleration on the A100 AI core.

When the AI inference module initializes, libspine_gemm_bridge.so initializes through the Python C API. The expected sequence is:

  1. ONNX Runtime loads SpacemiT EP
  2. EP calls libspine_gemm_bridge.so during initialization
  3. The bridge library initializes the Python interpreter environment

Steps

1. Verify the Environment

bash

Check the Python version python3 --version # Output: Python 3.14.0 # Check whether the spacemit-tcm package is installed dpkg -l | grep spacemit-tcm # Locate the bridge library find /usr -name “libspine_gemm_bridge.so” 2>/dev/null

2. Trigger Initialization

When the AI inference module initializes, the bridge library is loaded and attempts to initialize the Python environment.

Results / Screenshots / Logs

Error Log

text

_ctypes undefined symbol: PyExc_SystemError

Root Cause Analysis

bash

Check the Python version linked by the bridge library ldd /usr/lib/libspine_gemm_bridge.so | grep python # Output: libpython3.14.so.1.0 => /usr/lib/riscv64-linux-gnu/libpython3.14.so.1.0 # Check the system Python version python3 --version # Output: Python 3.14.0 # Check whether the symbol exists nm -D /usr/lib/riscv64-linux-gnu/libpython3.14.so.1.0 | grep PyExc_SystemError # Output: … PyExc_SystemError

Key Findings

  • libspine_gemm_bridge.so is linked to Python 3.14
  • However, the bridge library fails to find the PyExc_SystemError symbol through _ctypes during initialization
  • The symbol exists in Python 3.14’s libpython3.14.so, but the bridge library’s initialization timing or dependency order is incorrect

Problem Encountered

Core issue: libspine_gemm_bridge.so is part of the spacemit-tcm package. It links to the system Python but does not handle the Python version dependency correctly, causing initialization to fail in a Python 3.14 environment.

Check Expected Actual
Python version compatibility :white_check_mark: Compatible :cross_mark: Initialization failed
PyExc_SystemError symbol :white_check_mark: Present :white_check_mark: Present
_ctypes symbol lookup :white_check_mark: Successful :cross_mark: Failed

Impact

  • The AI inference module cannot initialize
  • ONNX Runtime + SpacemiT EP cannot use the A100 AI core for acceleration
  • Inference tasks are blocked

Your Assessment / Suggestions for Improvement

Assessment

  1. Incomplete version dependency: libspine_gemm_bridge.so links to the Python 3.14 library but fails to resolve the symbol correctly during _ctypes initialization. This suggests that the bridge library’s initialization logic depends on Python internal state that has not been properly initialized.
  2. Possible initialization order issue: The _ctypes module itself cannot be used until the Python interpreter is fully initialized. If the bridge library attempts to call _ctypes before the Python interpreter is fully initialized, symbol lookup will fail.
  3. Compatibility with Python 3.14: Python 3.14 is relatively new, and some internal APIs may have changed. The bridge library may not have been sufficiently tested against this version.

libspine_gemm_bridge.so 似乎不是spacemit-tcm包内的库

我已经自己解决这个问题

1 Like