From 07f72a50df2ae7ea35898ca54886a42eb829abb0 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Sun, 20 Sep 2026 23:28:51 -0700 Subject: [PATCH] Fix builds on FreeBSD 15 Cython's thread-safe module state lookup uses the C11 threads API on CPython 3.12+. FreeBSD provides that API in libstdthreads, so link against it explicitly. Fixes: #1334 --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.py b/setup.py index 11d73c0b..76a5c40a 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,11 @@ # Link against libm (math library) for functions like log10() LDFLAGS.extend(['-lm']) +if platform.uname().system == 'FreeBSD': + # Cython's thread-safe module state lookup uses the C11 threads API on + # CPython 3.12+. FreeBSD provides that API in libstdthreads. + LDFLAGS.extend(['-lstdthreads']) + _ROOT = pathlib.Path(__file__).parent