[Python] ImportError: undefined symbol: __powf_finite when importing pyflex extension built...

Discussão em 'Python' iniciado por Stack, Abril 29, 2025.

  1. Stack

    Stack Membro Participativo

    I’m building the SoftGym/PyFlex Python extension with CMake + pybind11 on Ubuntu. The build completes without errors, but when I try:

    import pyflex


    in the Python shell, I get:

    ImportError: /…/softgym/PyFlex/bindings/build/pyflex.cpython-36m-x86_64-linux-gnu.so:
    undefined symbol: __powf_finite


    Environment

    • Ubuntu 18.04 x86_64
    • Python 3.6.13 (Anaconda)
    • GCC 7.5.0
    • CUDA 12.6
    • CMake 3.10+
    • pybind11 2.x
    • SoftGym latest master

    Here's an excerpt from my CMakeLists.txt:

    find_package(CUDA REQUIRED)
    find_package(pybind11 REQUIRED)

    pybind11_add_module(pyflex ${SOURCES})

    target_link_libraries(pyflex PRIVATE
    EGL
    ${ROOT}/lib/linux64/NvFlexExtReleaseCUDA_x64.a
    ${ROOT}/lib/linux64/NvFlexReleaseCUDA_x64.a
    ${ROOT}/external/SDL2-2.0.4/lib/x64/libSDL2-2.0.so.0.4.0
    ${ROOT}/external/SDL2-2.0.4/lib/x64/libSDL2.a
    ${CUDA_LIBRARIES}
    /usr/lib/x86_64-linux-gnu/libmvec.a # (attempted static link)
    )


    Build:

    cd softgym/PyFlex/bindings
    rm -rf build && mkdir build && cd build
    cmake .. -DPYTHON_EXECUTABLE="$(which python)"
    make -j8 VERBOSE=1 pyflex


    What I’ve tried

    • Linking -lm
    • Wrapping m in -Wl,--whole-archive / --no-whole-archive
    • Preloading libm.so.6 and libmvec.so.1 via LD_PRELOAD
    • Statically linking both /usr/lib/.../libm.a and /usr/lib/.../libmvec.a

    All yield the same undefined‐symbol error at import time.

    Question What is the correct way to link or embed the standard math and vector‐math libraries so that __powf_finite is resolved inside the resulting .so? Are there additional linker flags or libraries I’m missing, or another approach to ensure Python can import pyflex without this error?

    Continue reading...

Compartilhe esta Página