Skip to content

configure mistakes none required for a curses library #155911

Description

@fedonman

Bug description:

AC_SEARCH_LIBS tries linking with no extra library first, so when a curses library is already in LIBS it succeeds and sets $ac_cv_search_initscr to the literal none required. When pkg-config found nothing, configure.ac copies that string into CURSES_LIBS and treats it as a curses library it discovered.

The string reaches the linker:

$ PKG_CONFIG=/bin/false ../cpython/configure LIBS="-lncursesw -ltinfo"
$ grep '^MODULE__CURSES_LDFLAGS=' Makefile
MODULE__CURSES_LDFLAGS=none required
$ make Modules/_curses.cpython-316-x86_64-linux-gnu.so
gcc -shared      Modules/_cursesmodule.o none required  -o Modules/_curses.cpython-316-x86_64-linux-gnu.so
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find none: No such file or directory
/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find required: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:3803: Modules/_curses.cpython-316-x86_64-linux-gnu.so] Error 1

The same result also overrides --without-curses, here with pkg-config working normally:

$ ../cpython/configure --without-curses LIBS="-lncursesw -lpanelw"
checking for --with-curses... no
checking for library containing initscr... none required
checking for library containing update_panels... none required
checking for stdlib extension module _curses... yes
checking for stdlib extension module _curses_panel... yes

Expected: none required names no library, so it should not become a linker flag, and Doc/using/configure.rst says --without-curses does not build the curses and curses.panel modules "even when a curses library is present".

Builds that do not put a curses library in LIBS are unaffected: the search returns -lncursesw and CURSES_LIBS is correct.

CPython versions tested on:

CPython main branch, 3.15

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    buildThe build process and cross-build
    on Aug 16, 2026
  2. added
    3.15bugs and security fixes
    3.16new features, bugs and security fixes
    on Aug 16, 2026
  3. added 3 commits that reference this issue on Aug 22, 2026
  4. added a commit that references this issue on Oct 9, 2026
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

    3.15bugs and security fixes3.16new features, bugs and security fixesbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions