Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/ncurses: install wide-char headers in usr/include/ncursesw/
@ 2026-10-29 20:49 Bernd Kuhls
  2026-10-29 20:49 ` [Buildroot] [PATCH 2/2] package/python3: bump version to 3.15.2 Bernd Kuhls
  2026-10-29 21:12 ` [Buildroot] [PATCH 1/2] package/ncurses: install wide-char headers in usr/include/ncursesw/ Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 6+ messages in thread
From: Bernd Kuhls @ 2026-10-29 20:49 UTC (permalink / raw)
  To: buildroot; +Cc: James Hilliard, Thomas Petazzoni

Python 3.15 changed its ncurses wide-/non-wide-char detection and now
relies on detecting the correct headers:
https://github.com/python/cpython/commit/383c7bd38a5f0923db48f67fda9d852d189921e6

Buildroot toolchain x86-64-core-i7--glibc--bleeding-edge-2026.08-1
contains the non-wide-char version of sysroot/usr/include/curses.h
which overwrites the wide-char version provided by the ncurses package
during the configure/rsync stage of the python3 package in the case of
BR2_PER_PACKAGE_DIRECTORIES=y. The toolchain package is sorted alpha-
betically after the ncurses package.

To provide correct headers for the python3 package and to not interfere
with other buildroot packages we additionally install only the wchar-
enabled headers in usr/include/ncursesw/ which is tested by python3
configure before usr/include/:
https://github.com/python/cpython/blob/v3.15.0rc3/configure.ac#L7149

Configure log snippet of python3 without this patch:

checking for ncursesw... yes
checking for panelw... yes
checking for ncursesw/curses.h... no
checking for ncursesw/ncurses.h... no
checking for ncursesw/panel.h... no
checking for ncurses/curses.h... no
checking for ncurses/ncurses.h... no
checking for ncurses/panel.h... no
checking for curses.h... yes
checking for ncurses.h... yes
checking for panel.h... yes
checking for library containing initscr... none required
checking for library containing update_panels... none required
checking whether curses supports wide characters... no
checking for term.h... yes

config.log contains:
configure:29861: checking whether curses supports wide characters
[...]
conftest.c:535:9: error: implicit declaration of function 'setcchar';
 did you mean 'getchar'? [-Wimplicit-function-declaration]
  535 |         setcchar(&wcval, L"x", A_NORMAL, 0, NULL);

Configure log snippet of python3 with this patch:

checking for ncursesw... yes
checking for panelw... yes
checking for ncursesw/curses.h... yes
checking for ncursesw/ncurses.h... no
checking for ncursesw/panel.h... yes
checking for ncurses/curses.h... no
checking for ncurses/ncurses.h... no
checking for ncurses/panel.h... no
checking for curses.h... yes
checking for ncurses.h... yes
checking for panel.h... yes
checking for library containing initscr... none required
checking for library containing update_panels... none required
checking whether curses supports wide characters... yes
checking for term.h... yes

The relevant line is 'checking whether curses supports wide characters'
which needs to have 'yes' as result when ncurses is configured with
BR2_PACKAGE_NCURSES_WCHAR=y, otherwise the python3 build is broken:

./Modules/_cursesmodule.c: In function ‘_curses_window_addch_impl’:
./Modules/_cursesmodule.c:1009:15: error: implicit declaration of
 function ‘setcchar’; did you mean ‘getchar’?
 [-Wimplicit-function-declaration]
./Modules/_cursesmodule.c:1015:19: error: implicit declaration of
 function ‘mvwadd_wch’; did you mean ‘mvwaddch’?
 [-Wimplicit-function-declaration]
./Modules/_cursesmodule.c:1019:19: error: implicit declaration o
f function ‘wadd_wch’; did you mean ‘waddch’?
 [-Wimplicit-function-declaration]

This patch should also fix similar problems:
https://lists.buildroot.org/pipermail/buildroot/2024-September/763179.html
https://lists.buildroot.org/pipermail/buildroot/2025-January/770215.html

The specific problem w.r.t. per-package directories was also discussed:

https://lists.buildroot.org/pipermail/buildroot/2021-August/684119.html

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 package/ncurses/ncurses.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/ncurses/ncurses.mk b/package/ncurses/ncurses.mk
index 5e2077500a..a9b2f089a4 100644
--- a/package/ncurses/ncurses.mk
+++ b/package/ncurses/ncurses.mk
@@ -85,6 +85,12 @@ NCURSES_CONF_OPTS += --enable-widec
 NCURSES_LIB_SUFFIX = w
 NCURSES_LIBS = ncurses menu panel form
 
+define NCURSES_COPY_WCHAR_HEADERS
+	$(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) \
+		INCLUDEDIR=$(STAGING_DIR)/usr/include/ncursesw \
+		install.includes
+endef
+
 define NCURSES_LINK_LIBS_STATIC
 	$(foreach lib,$(NCURSES_LIBS:%=lib%), \
 		ln -sf $(lib)$(NCURSES_LIB_SUFFIX).a $(STAGING_DIR)/usr/lib/$(lib).a
@@ -116,6 +122,7 @@ NCURSES_LINK_STAGING_PC = $(call NCURSES_LINK_PC)
 
 NCURSES_CONF_OPTS += --enable-ext-colors
 
+NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_COPY_WCHAR_HEADERS
 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_PC
 else
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-29 21:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 20:49 [Buildroot] [PATCH 1/2] package/ncurses: install wide-char headers in usr/include/ncursesw/ Bernd Kuhls
2026-10-29 20:49 ` [Buildroot] [PATCH 2/2] package/python3: bump version to 3.15.2 Bernd Kuhls
2026-10-29 21:13   ` Thomas Petazzoni via buildroot
     [not found]   ` <auO2ugenOrGrEKGM__30665.5666836136$1793308450$gmane$org@windsurf>
2026-10-29 21:33     ` Bernd Kuhls
2026-10-29 21:49       ` Thomas Petazzoni via buildroot
2026-10-29 21:12 ` [Buildroot] [PATCH 1/2] package/ncurses: install wide-char headers in usr/include/ncursesw/ Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox