Skip to content

Fix missing libm linkage for _core extension on Linux#993

Open
Siyet wants to merge 1 commit intojcrist:mainfrom
Siyet:971-fix-libm-linkage
Open

Fix missing libm linkage for _core extension on Linux#993
Siyet wants to merge 1 commit intojcrist:mainfrom
Siyet:971-fix-libm-linkage

Conversation

@Siyet
Copy link
Copy Markdown

@Siyet Siyet commented Mar 31, 2026

Summary

  • Add explicit -lm linkage for the _core C extension on non-Windows platforms
  • Fixes undefined symbol errors (nextafter, fmod, lround) on aarch64 Linux systems where libm is not implicitly linked

Closes #971

Test plan

Built and verified with ldd on two environments:

Ubuntu 22.04 (WSL2, x86_64, gcc 11.4, Python 3.10):

libm linked?
Without fix No - only libc.so.6
With fix Yes - libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6

Ubuntu 24.04 (WSL2, x86_64, gcc 13.3, Python 3.12):

libm linked?
Without fix No - only libc.so.6
With fix Yes - libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6

Windows 11 (Python 3.12, AMD64):

Confirmed that -lm is not added on win32 - libraries list stays empty. libm is part of MSVC runtime, no explicit linkage needed.

  • CI passes on all platforms

Add explicit -lm linkage for the _core C extension on non-Windows
platforms. Fixes undefined symbol errors (nextafter, fmod, lround)
on aarch64 Linux systems where libm is not implicitly linked.

Closes jcrist#971
@Siyet
Copy link
Copy Markdown
Author

Siyet commented Mar 31, 2026

CI failures are unrelated to this change:

All build, test, and wheel jobs pass across all platforms.

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.

Missing libm linkage for _core extension causes undefined symbol errors

1 participant