serhiy-storchaka · GitHub

Bug report

Building main on FreeBSD (tested 15.1-RELEASE) fails since gh-150534:

./Modules/mathmodule.c:566:24: error: call to undeclared function 'sinpi'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]

FreeBSD's libm exports cospi, sinpi and tanpi, but math.h declares them only for C23. CPython compiles with -std=c11 and defines _POSIX_C_SOURCE/_XOPEN_SOURCE, which reduces header visibility to C11. The link-only AC_CHECK_FUNCS test still finds the symbols and defines HAVE_SINPI etc., so compiling Modules/mathmodule.c fails. Linux is unaffected because glibc's _GNU_SOURCE implies _ISOC23_SOURCE.

The fix is to define _ISOC23_SOURCE, the feature-test macro both FreeBSD and glibc honor: the declarations become visible and the native libm implementations are actually used (FreeBSD's tanpi(0.25) returns exactly 1.0).

Linked PRs

Read the original on github.com ↗