| From: | Jianghua Yang <yjhjstz(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | [PATCH] Fix build failure on macOS 26.2 SDK due to missing nl_langinfo_l declaration |
| Date: | 2026-03-19 18:06:17 |
| Message-ID: | CAAZLFmS6_si5W8LqSynj5J1uK6Xhe5Q7Ucg7LE1PZ8OqO9kvCA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
Building PostgreSQL against the macOS 26.2 SDK (Xcode 26 beta) fails
with the following error:
src/port/chklocale.c:326:8: error: call to undeclared function
'nl_langinfo_l'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
sys = nl_langinfo_l(CODESET, loc);
== Root Cause ==
macOS 26.2 SDK changed the structure of <langinfo.h>. In previous
SDK versions, nl_langinfo_l() was declared unconditionally. In the
new SDK, it is only exposed when _USE_EXTENDED_LOCALES_ is defined,
guarded behind a conditional include of <xlocale/_langinfo.h>:
/* macOS 26.2 SDK: langinfo.h */
#include <_langinfo.h> /* nl_langinfo() only */
#ifdef _USE_EXTENDED_LOCALES_
#include <xlocale/_langinfo.h> /* nl_langinfo_l() */
#endif
PostgreSQL's chklocale.c only includes <langinfo.h> directly, so
nl_langinfo_l() is no longer visible on macOS 26.2.
== Fix ==
Include <xlocale.h> explicitly on Apple platforms. This header
declares nl_langinfo_l() unconditionally and is the standard way
to access locale-specific extensions on macOS.
Tested on macOS 26.2 (darwin 25.3) with Apple Clang 17.
Patch attached.
Regards,
Jianghua Yang
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-build-failure-on-macOS-26.2-SDK-due-to-missing-n.patch | application/octet-stream | 1.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Lukas Fittl | 2026-03-19 18:11:16 | Re: EXPLAIN: showing ReadStream / prefetch stats |
| Previous Message | 段坤仁 (刻韧) | 2026-03-19 18:02:30 | Bug in MultiXact replay compat logic for older minor version after crash-recovery |