Repository navigation
configure mistakes none required for a curses library #155911
Description
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
- gh-155911: Fix curses detection with libraries in LIBS #156130
- [3.15] gh-155911: Fix curses detection with libraries in LIBS (GH-156130) #156223
- [3.14] gh-155911: Fix curses detection with libraries in LIBS (GH-156130) #156224
- [3.13] gh-155911: Fix curses detection with libraries in LIBS (GH-156130) #156225
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Activity
gh-155911: Fix curses detection with libraries in LIBS (GH-156130)
[3.14] gh-155911: Fix curses detection with libraries in LIBS (GH-156130
[3.13] gh-155911: Fix curses detection with libraries in LIBS (GH-156130
[3.15] gh-155911: Fix curses detection with libraries in LIBS (GH-156130