Skip to content

./configure misses option to avoid building with ncurses #136687

Closed

Description

@dilyanpalauzov

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.

./configure --without-readline --with-lto --enable-shared --without-static-libpython --prefix=/root/chroot-n/python --disable-ipv6 --enable-optimizations CFLAGS='--sysroot=/root/chroot-n -Ichr/include -Wl,--dynamic-linker=/chr/lib/ld-linux-x86-64.so.2'

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.

Linked PRs

Activity

  1. 30November commented on Jul 15, 2025

    @30November

    Please explain more details like what is ncurses

  2. dilyanpalauzov commented on Jul 15, 2025

    @dilyanpalauzov
    Author

    Please explain more details like what is ncurses

    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)
          |                                                                    ^~~~~~
    

    and so on 2000 lines.

  3. added
    type-featureA feature request or enhancement
    buildThe build process and cross-build
    type-bugAn unexpected behavior, bug, or error
    and removed
    type-featureA feature request or enhancement
    on Jul 15, 2025
  4. picnixz commented on Jul 15, 2025

    @picnixz
    Member

    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.

  5. duaneg commented on Jul 15, 2025

    @duaneg
    Contributor

    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.

  6. added a commit that references this issue on Jul 15, 2025
  7. dilyanpalauzov commented on Jul 16, 2025

    @dilyanpalauzov
    Author
    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.
  8. duaneg commented on Jul 16, 2025

    @duaneg
    Contributor

    " (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.

  9. glandium commented on Jan 15, 2026

    @glandium

    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]
    
  10. added 3 commits that reference this issue on Jul 18, 2026
  11. serhiy-storchaka commented on Jul 19, 2026

    @serhiy-storchaka
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions