Skip to content

Building _curses against narrow ncurses fails: undefined symbol term_attrs #158078

Description

@serhiy-storchaka

Bug report

Since #152332 added curses.term_attrs(), _curses fails to import when built against the narrow ncurses library, for example with --with-curses=ncurses:

[ERROR] _curses failed to import: .../_curses.cpython-316d-x86_64-linux-gnu.so: undefined symbol: term_attrs

ncurses defines term_attrs() only in the wide library (libncursesw). However, configure detects curses functions with a compile-only check (PY_CHECK_CURSES_FUNC), so it only verifies that a header declares the function. The header used is often built with wide support (ncursesw/curses.h, or even /usr/include/curses.h on Debian when _XOPEN_SOURCE is defined), and it declares term_attrs(). So HAVE_CURSES_TERM_ATTRS gets defined while the module links with -lncurses.

PY_CHECK_CURSES_FUNC should be a link check, like the check for the wide character API.

Reported on Discourse: https://discuss.python.org/t/compiling-cpython-fails-without-wide-char-ncurses/109209

Linked PRs

Activity

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions