Skip to content

Missing libm linkage for _core extension causes undefined symbol errors #971

Closed

Description

@BwL1289

Description

The msgspec._core extension module fails to load on some systems due to missing linkage against the math library (libm). This causes undefined symbol errors for mathematical functions like nextafter, fmod, and lround.

bash[./lib/python3.12/site-packages/msgspec/_core.cpython-312-aarch64-linux-gnu.so]:
    linux-vdso.so.1 (0x0000ffffbab2c000)
    libc.so.6 => /lib64/libc.so.6 (0x0000ffffba883000)
    /lib/ld-linux-aarch64.so.1 (0x0000ffffbaadf000)
undefined symbol: nextafter	(./lib/python3.12/site-packages/msgspec/_core.cpython-312-aarch64-linux-gnu.so)
undefined symbol: fmod	(./lib/python3.12/site-packages/msgspec/_core.cpython-312-aarch64-linux-gnu.so)
undefined symbol: lround	(./lib/python3.12/site-packages/msgspec/_core.cpython-312-aarch64-linux-gnu.so)

Workaround is to use a sed patch to explicitly link the math library:

sed -i 's/\(os\.path\.join([^)]*"_core\.c")\)\],/\1], libraries=["m"],/' "./setup.py""

Environment

Platform: aarch64-linux-gnu
Python version: 3.12
Architecture: ARM64

Activity

  1. Siyet commented on Apr 8, 2026

    @Siyet
    Contributor

    Resolved in the community fork msgspec-arise: issue #3, released in v0.20.2.

  2. added a commit that references this issue on Apr 8, 2026
    719a216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions