Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
On a system I'm trying to build Python for, I have libncurses.so available but not libncursesw.so.
Unfortunately, although this is not documented directly anywhere I can find, the ncurses extended_pair_content() and extended_color_content() functions (and theinit_extended_*() functions) are not available in libncurses, they are only available in libncursesw. This causes the compilation of Python to fail:
checking for curses.h... yeschecking for ncurses.h... yeschecking for ncursesw... nochecking for initscr in -lncursesw... nochecking for ncurses... nochecking for initscr in -lncurses... yeschecking curses module flags... ncurses (CFLAGS: , LIBS: -lncurses)checking for panel.h... yeschecking for panel... nochecking for update_panels in -lpanel... yeschecking panel flags... panel (CFLAGS: , LIBS: -lpanel)checking for term.h... yeschecking whether mvwdelch is an expression... yeschecking whether WINDOW has _flags... yeschecking for curses function is_pad... yeschecking for curses function is_term_resized... yeschecking for curses function resize_term... yeschecking for curses function resizeterm... yeschecking for curses function immedok... yeschecking for curses function syncok... yeschecking for curses function wchgat... yeschecking for curses function filter... yeschecking for curses function has_key... yeschecking for curses function typeahead... yeschecking for curses function use_env... yes ...checking for stdlib extension module _curses... yeschecking for stdlib extension module _curses_panel... yes ...86_64-rl84-linux-gnu-gcc -pthread -shared Modules/_cursesmodule.o -lncurses -o Modules/_curses.cpython-312-x86_64-linux-gnu.so ..../python -E -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform[ERROR] _curses failed to import: /data/src/python3/Linux-Release-make/bld.python3/build/lib.linux-x86_64-3.12/_curses.cpython-312-x86_64-linux-gnu.so: undefined symbol: extended_pair_contentIf I try a simple program:
#include <ncurses.h>#include <stdio.h>int main(void){ initscr(); start_color(); { int f, b; int r = extended_pair_content(1, &f, &b); printf("r=%d f=%d b=%d\n", r, f, b); } endwin(); return 0;}then it works if I link with-lncursesw:
$ gcc -o /tmp/foo /tmp/foo.c -lncursesw$But fails if I only link with-lncurses:
$ gcc -o /tmp/foo /tmp/foo.c -lncurses/bin/ld: /tmp/cccHNZsN.o: in function `main':foo.c:(.text+0x85): undefined reference to `extended_pair_content'/bin/ld: foo.c:(.text+0x107): undefined reference to `extended_color_content'collect2: error: ld returned 1 exit status$I believe this patch will fix it:
--- a/Modules/_cursesmodule.c 2024-09-06 15:03:47.000000000 -0400+++ b/Modules/_cursesmodule.c 2024-09-10 17:41:55.124440110 -0400@@ -139,7 +139,7 @@ #define STRICT_SYSV_CURSES #endif-#if NCURSES_EXT_FUNCS+0 >= 20170401 && NCURSES_EXT_COLORS+0 >= 20170401+#if HAVE_NCURSESW && NCURSES_EXT_FUNCS+0 >= 20170401 && NCURSES_EXT_COLORS+0 >\= 20170401 #define _NCURSES_EXTENDED_COLOR_FUNCS 1 #else #define _NCURSES_EXTENDED_COLOR_FUNCS 0CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done