You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
./configure misses option to avoid building with ncurses #136687
With Python 3.13.5 I see no way to tell ./configure to avoid using ncurses. I want to execute the final binary in a chrooted environment, where ncurses/curses/ncursesw are not available.
However on the host system ncursesw is available. The above command produces
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... no
checking for ncurses.h... no
checking for panel.h... no
checking for library containing initscr... none required
checking for library containing update_panels... none required
checking for term.h... no
checking whether mvwdelch is an expression... no
checking whether WINDOW has _flags... no
checking for curses function is_pad... no
checking for curses function is_term_resized... no
checking for curses function resize_term... no
checking for curses function resizeterm... no
checking for curses function immedok... no
checking for curses function syncok... no
checking for curses function wchgat... no
checking for curses function filter... no
checking for curses function has_key... no
checking for curses function typeahead... no
checking for curses function use_env... no
…
checking for stdlib extension module _curses... yes
checking for stdlib extension module _curses_panel... yes
doing later make fails, as the header files are missing.
I want to be able to pass an option to ./configure so that it does not build curses/ncurses/ncursesw.
This is a library for building text user interfaces (GUI on the terminal).
When cpython is built, these are the error messages:
In file included from ./Modules/_cursesmodule.c:117:
./Include/py_curses.h:80:5: error: unknown type name ‘WINDOW’
80 | WINDOW *win;
| ^~~~~~
./Modules/_cursesmodule.c:174:36: error: ‘FALSE’ undeclared here (not in a function)
174 | static int initialised_setupterm = FALSE;
| ^~~~~
./Modules/_cursesmodule.c: In function ‘PyCursesCheckERR’:
./Modules/_cursesmodule.c:214:17: error: ‘ERR’ undeclared (first use in this function); did you mean ‘ERA’?
214 | if (code != ERR) {
| ^~~
| ERA
./Modules/_cursesmodule.c:214:17: note: each undeclared identifier is reported only once for each function it appears in
./Modules/_cursesmodule.c: At top level:
./Modules/_cursesmodule.c:234:68: error: unknown type name ‘chtype’
234 | PyCurses_ConvertToChtype(PyCursesWindowObject *win, PyObject *obj, chtype *ch)
| ^~~~~~
I'm treating as a bug for now but it might because the paths where to look at do not have the header files. So it could be a configure issue or a feature.
FWIW I think this is a feature request to extend the build system to allow manual control over whether ncurses should be linked in, not a bug as such. It seems like a very reasonable thing to want to do when cross-compiling. ncurses is already optional and skipped if it isn't present on the host system, so hopefully it will be straight-forward to allow manual control.
AC_ARG_ENABLE([ncurses], [AS_HELP_STRING(
[--disable-ncurses],
[disable linking ncurses (default is no)])], [
" (default is no)" is not necessary. This is implied by the --disable- text on --help, see https://ab.bapha.be/posts/help-output/ . In short: --help provides only hints how to alter the default behaviour. But ./configure --help currently prints:
--disable-gil enable experimental support for running without the
GIL (default is no)
--enable-pystats enable internal statistics gathering (default is no)
It should be --enable-gil as by default it is disabled.
Then spelling on both places “(default is no)” will not be necessary.
" (default is no)" is not necessary. This is implied by the --disable- text on --help, see https://ab.bapha.be/posts/help-output/ . In short: --help provides only hints how to alter the default behaviour.
That all sounds very sensible and FWIW I generally agree, but as you say, at present that isn't the convention the help text uses. I'd be happy to drop the "(default is no)" once there is agreement that is the correct thing to do, but for now I think we should keep it consistent with the existing help text.
If/when #136700 is done I'll update it as part of that.
Note that the build system does have an implicit way to disable ncurses, when its headers are not around. The problem is that the build still fails, because not everything that should be behind HAVE_TERM_H is behind HAVE_TERM_H, while #include "term.h" is behind HAVE_TERM_H.
Which leads to build failures such as:
Modules/_cursesmodule.c:3412:35: error: implicit declaration of function ‘setupterm’; did you mean ‘set_term’? [-Werror=implicit-function-declaration]
I needed more control on the build, so I added --with-curses= to select the curses backend. This allows to build without hacks against native curses on NetBSD and Solaris. --with-curses=no and --without-curses exclude the curses and _curses_panel modules from the build.
Activity
30November commentedon Jul 15, 2025
Please explain more details like what is ncurses
dilyanpalauzov commentedon Jul 15, 2025
This is a library for building text user interfaces (GUI on the terminal).
When cpython is built, these are the error messages:
and so on 2000 lines.
picnixz commentedon Jul 15, 2025
I'm treating as a bug for now but it might because the paths where to look at do not have the header files. So it could be a configure issue or a feature.
duaneg commentedon Jul 15, 2025
FWIW I think this is a feature request to extend the build system to allow manual control over whether
ncursesshould be linked in, not a bug as such. It seems like a very reasonable thing to want to do when cross-compiling.ncursesis already optional and skipped if it isn't present on the host system, so hopefully it will be straight-forward to allow manual control.pythongh-136687: allow manually excluding ncurses from the build
dilyanpalauzov commentedon Jul 16, 2025
" (default is no)" is not necessary. This is implied by the
--disable-text on--help, see https://ab.bapha.be/posts/help-output/ . In short:--helpprovides only hints how to alter the default behaviour. But./configure --helpcurrently prints:--enable-gilas by default it is disabled.duaneg commentedon Jul 16, 2025
That all sounds very sensible and FWIW I generally agree, but as you say, at present that isn't the convention the help text uses. I'd be happy to drop the "(default is no)" once there is agreement that is the correct thing to do, but for now I think we should keep it consistent with the existing help text.
If/when #136700 is done I'll update it as part of that.
glandium commentedon Jan 15, 2026
Note that the build system does have an implicit way to disable ncurses, when its headers are not around. The problem is that the build still fails, because not everything that should be behind HAVE_TERM_H is behind HAVE_TERM_H, while
#include "term.h"is behind HAVE_TERM_H.Which leads to build failures such as:
Merge branch 'main' into pythongh-136687
pythongh-136687: Fix the wide-character probe for native curses
pythongh-136687: Match the panel and headers to the selected curses b…
gh-136687: Add ./configure --with-curses to select the curses backend (…
serhiy-storchaka commentedon Jul 19, 2026
I needed more control on the build, so I added
--with-curses=to select the curses backend. This allows to build without hacks against native curses on NetBSD and Solaris.--with-curses=noand--without-cursesexclude thecursesand_curses_panelmodules from the build.