python3: fix build on Linux where /usr/include/ncurses.h is broken

If --with-python=internal is used, then building its curses module
expects an ncurses header with wide char support, otherwise the build
fails with:

	/usr/bin/ccache clang -fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=local-bounds -fsanitize-blacklist=sanitize-ubsan-excludelist -fno-sanitize=function -Iworkdir/UnpackedTarball/bzip2 -Iworkdir/UnpackedTarball/expat/lib -Iworkdir/UnpackedTarball/sqlite3 -Iworkdir/UnpackedTarball/lzma/src/liblzma/api  -fno-strict-overflow -Wsign-compare -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -Og -Wall -Iworkdir/UnpackedTarball/zlib -O0 -Wp,-U_FORTIFY_SOURCE -fstrict-aliasing -fstrict-overflow   -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal  -I. -I./Include   -fPIC -fPIC -c ./Modules/_cursesmodule.c -o Modules/_cursesmodule.o
	./Modules/_cursesmodule.c:764:9: error: call to undeclared function 'setcchar'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
	  764 |         setcchar(&wcval, wstr, attr, PAIR_NUMBER(attr), NULL);
	      |         ^

Turns out that /usr/include/ncurses.h and
/usr/include/ncursesw/ncurses.h are not the same here and only the later
provides the wide char support.

Fix this by explicitly adding /usr/include/ncursesw to the include path
on Linux, which should help when that dir exists and it's meant to be
ignored otherwise.

Change-Id: Ic967163d4dbab5df6a0c95146f0d92b564c9901c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201935
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
Miklos Vajna
2026-03-18 08:30:04 +01:00
parent 38c6bf2364
commit db0cbfb2ba
+1
View File
@@ -122,6 +122,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(if $(SYSTEM_SQLITE3),,-I$(gb_UnpackedTarball_workdir)/sqlite3) \
$(if $(SYSTEM_LZMA),,-I$(gb_UnpackedTarball_workdir)/lzma/src/liblzma/api) \
$(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
$(if $(filter LINUX,$(OS)),-I/usr/include/ncursesw) \
)" \
$(if $(python3_cflags),CFLAGS='$(python3_cflags)') \
$(if $(filter -fsanitize=%,$(CC)),LINKCC="$(CXX) -pthread") \