This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python with ncurses6.0 will not load _curses module on Solaris 10
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, jcea, jonesrw, terry.reedy
Priority: normal Keywords:

Created on 2016-01-26 23:40 by jonesrw, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg258984 - (view) Author: R. Jones (jonesrw) Date: 2016-01-26 23:40
I am trying to compile Python-2.7.10.  This is being done as a user, not root and I don't have access to /usr/local other than to avoid all the broken stuff in it.

My local is /appl/local

I am installing Python in /appl/local/python-2.7.10

I have ncursest as part of my /appl/local, but python keeps wanting to link with /usr/ccs/lib/libcurses.so.  UGH.
"ncursest" was built instead of "ncurses" because I used "--with-pthread" and "--enable-reentrant"


I rebuilt ncurses without those two flags but with --with-termlib which built libtinfo.so.  When compiling the _curses module, I get this error:

*** WARNING: renaming "_curses" since importing it failed: ld.so.1: python: fatal: relocation error: file build/lib.solaris-2.10-sun4u.32bit-2.7/_curses.so: symbol _unctrl: referenced symbol not found

In this case I can see unctrl is in tinfo...but no matter what I do, I cannot get it to add -ltinfo to the link line.

$ nm -s libtinfo.so | grep unctrl
0001d4f8 T unctrl
00039170 r unctrl_blob.5682
00039070 r unctrl_c1.5681
0001d30c T unctrl_sp
00039572 r unctrl_table.5680


So my next attempt was to make a private copy of ncurses for Python without --with-termlib, but had to add --enable-termcap and install it in /appl/local/python-2.7.10/lib

$ ls -al /appl/local/python-2.7.10/lib
total 15584
drwxr-xr-x   4 gfp-ip   gfp-ip      1024 Jan 26 16:45 .
drwxr-xr-x   6 gfp-ip   gfp-ip        96 Jan 26 15:31 ..
-rw-r--r--   1 gfp-ip   gfp-ip    120560 Jan 26 15:32 libform.a
-rwxr-xr-x   1 gfp-ip   gfp-ip      1055 Jan 26 15:32 libform.la
lrwxrwxrwx   1 gfp-ip   gfp-ip        16 Jan 26 15:32 libform.so -> libform.so.6.0.0
lrwxrwxrwx   1 gfp-ip   gfp-ip        16 Jan 26 15:32 libform.so.6 -> libform.so.6.0.0
-rwxr-xr-x   1 gfp-ip   gfp-ip     95604 Jan 26 15:32 libform.so.6.0.0
-rw-r--r--   1 gfp-ip   gfp-ip     61908 Jan 26 15:32 libmenu.a
-rwxr-xr-x   1 gfp-ip   gfp-ip      1055 Jan 26 15:32 libmenu.la
lrwxrwxrwx   1 gfp-ip   gfp-ip        16 Jan 26 15:32 libmenu.so -> libmenu.so.6.0.0
lrwxrwxrwx   1 gfp-ip   gfp-ip        16 Jan 26 15:32 libmenu.so.6 -> libmenu.so.6.0.0
-rwxr-xr-x   1 gfp-ip   gfp-ip     48060 Jan 26 15:32 libmenu.so.6.0.0
-rw-r--r--   1 gfp-ip   gfp-ip    174364 Jan 26 15:32 libncurses++.a
-rwxr-xr-x   1 gfp-ip   gfp-ip      1295 Jan 26 15:32 libncurses++.la
lrwxrwxrwx   1 gfp-ip   gfp-ip        21 Jan 26 15:32 libncurses++.so -> libncurses++.so.6.0.0
lrwxrwxrwx   1 gfp-ip   gfp-ip        21 Jan 26 15:32 libncurses++.so.6 -> libncurses++.so.6.0.0
-rwxr-xr-x   1 gfp-ip   gfp-ip    114812 Jan 26 15:32 libncurses++.so.6.0.0
-rw-r--r--   1 gfp-ip   gfp-ip    628332 Jan 26 15:31 libncurses.a
-rwxr-xr-x   1 gfp-ip   gfp-ip      1019 Jan 26 15:31 libncurses.la
lrwxrwxrwx   1 gfp-ip   gfp-ip        19 Jan 26 15:31 libncurses.so -> libncurses.so.6.0.0
lrwxrwxrwx   1 gfp-ip   gfp-ip        19 Jan 26 15:31 libncurses.so.6 -> libncurses.so.6.0.0
-rwxr-xr-x   1 gfp-ip   gfp-ip    478356 Jan 26 15:31 libncurses.so.6.0.0
-rw-r--r--   1 gfp-ip   gfp-ip     26324 Jan 26 15:31 libpanel.a
-rwxr-xr-x   1 gfp-ip   gfp-ip      1062 Jan 26 15:31 libpanel.la
lrwxrwxrwx   1 gfp-ip   gfp-ip        17 Jan 26 15:31 libpanel.so -> libpanel.so.6.0.0
lrwxrwxrwx   1 gfp-ip   gfp-ip        17 Jan 26 15:31 libpanel.so.6 -> libpanel.so.6.0.0
-rwxr-xr-x   1 gfp-ip   gfp-ip     23652 Jan 26 15:31 libpanel.so.6.0.0

$ nm /appl/local/python-2.7.10/lib/libncurses.so | grep unctrl
0004acac T unctrl
00067540 r unctrl_blob.5717
00067440 r unctrl_c1.5716
0004aac0 T unctrl_sp
00067942 r unctrl_table.5715

So ONCE again, compiling Python module _curses with the new lib:
Script started on Tue Jan 26 19:36:55 2016
$ make
running build
running build_ext
building dbm using ndbm
building '_curses' extension
gcc -fPIC -fno-strict-aliasing -I/appl/local/python-2.7.10/include -I/appl/local/include -DNCURSES_OPAQUE=0 -DNCURSES_REENTRANT=0 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/appl/local/python-2.7.10/include -I/appl/local/include -I/usr/local/include -I/appl/logs/local_build/src/python.org/Python-2.7.10/Include -I/appl/logs/local_build/src/python.org/Python-2.7.10 -c /appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_cursesmodule.c -o build/temp.solaris-2.10-sun4u.32bit-2.7/appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_cursesmodule.o
/appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_cursesmodule.c: In function 'PyCursesWindow_ChgAt':
/appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_cursesmodule.c:713:9: warning: implicit declaration of function 'mvwchgat' [-Wimplicit-function-declaration]
/appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_cursesmodule.c:717:9: warning: implicit declaration of function 'wchgat' [-Wimplicit-function-declaration]
gcc -shared -L/appl/local/python-2.7.10/lib -Wl,-rpath,/appl/local/python-2.7.10/lib -lncurses -R/appl/local/python-2.7.10/lib -L/appl/local/lib -L/appl/local/python-2.7.10/lib -Wl,-rpath,/appl/local/python-2.7.10/lib -lncurses -R/appl/local/python-2.7.10/lib -L/appl/local/lib -fno-strict-aliasing -I/appl/local/python-2.7.10/include -I/appl/local/include -DNCURSES_OPAQUE=0 -DNCURSES_REENTRANT=0 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/appl/local/python-2.7.10/include -I/appl/local/include -DNCURSES_OPAQUE=0 -DNCURSES_REENTRANT=0 build/temp.solaris-2.10-sun4u.32bit-2.7/appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_cursesmodule.o -L/appl/local/python-2.7.10/lib -L/appl/local/lib -L/usr/local/lib -L. -Wl,-R/appl/local/python-2.7.10/lib -lncurses -lpython2.7 -o build/lib.solaris-2.10-sun4u.32bit-2.7/_curses.so

*** WARNING: renaming "_curses" since importing it failed: ld.so.1: python: fatal: relocation error: file build/lib.solaris-2.10-sun4u.32bit-2.7/_curses.so: symbol _unctrl: referenced symbol not found

building '_curses_panel' extension
gcc -fPIC -fno-strict-aliasing -I/appl/local/python-2.7.10/include -I/appl/local/include -DNCURSES_OPAQUE=0 -DNCURSES_REENTRANT=0 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/appl/local/python-2.7.10/include -I/appl/local/include -I/usr/local/include -I/appl/logs/local_build/src/python.org/Python-2.7.10/Include -I/appl/logs/local_build/src/python.org/Python-2.7.10 -c /appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_curses_panel.c -o build/temp.solaris-2.10-sun4u.32bit-2.7/appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_curses_panel.o
gcc -shared -L/appl/local/python-2.7.10/lib -Wl,-rpath,/appl/local/python-2.7.10/lib -lncurses -R/appl/local/python-2.7.10/lib -L/appl/local/lib -L/appl/local/python-2.7.10/lib -Wl,-rpath,/appl/local/python-2.7.10/lib -lncurses -R/appl/local/python-2.7.10/lib -L/appl/local/lib -fno-strict-aliasing -I/appl/local/python-2.7.10/include -I/appl/local/include -DNCURSES_OPAQUE=0 -DNCURSES_REENTRANT=0 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -I/appl/local/python-2.7.10/include -I/appl/local/include -DNCURSES_OPAQUE=0 -DNCURSES_REENTRANT=0 build/temp.solaris-2.10-sun4u.32bit-2.7/appl/logs/local_build/src/python.org/Python-2.7.10/Modules/_curses_panel.o -L/appl/local/python-2.7.10/lib -L/appl/local/lib -L/usr/local/lib -L. -Wl,-R/appl/local/python-2.7.10/lib -lpanel -lncurses -lpython2.7 -o build/lib.solaris-2.10-sun4u.32bit-2.7/_curses_panel.so
*** WARNING: renaming "_curses_panel" since importing it failed: No module named _curses

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             bsddb185           linuxaudiodev   
ossaudiodev                                           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_curses            _curses_panel

Here is LDD output for the built python:
$ ldd python
        libncurses.so.6 =>       /appl/local/python-2.7.10/lib/libncurses.so.6
        libpython2.7.so.1.0 =>   /appl/local/python-2.7.10/lib/libpython2.7.so.1.0
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        librt.so.1 =>    /lib/librt.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libm.so.2 =>     /lib/libm.so.2
        libc.so.1 =>     /lib/libc.so.1
        libgcc_s.so.1 =>         /appl/local/lib/libgcc_s.so.1
        libmp.so.2 =>    /lib/libmp.so.2
        libmd.so.1 =>    /lib/libmd.so.1
        libscf.so.1 =>   /lib/libscf.so.1
        libaio.so.1 =>   /lib/libaio.so.1
        libdoor.so.1 =>  /lib/libdoor.so.1
        libuutil.so.1 =>         /lib/libuutil.so.1
        libgen.so.1 =>   /lib/libgen.so.1
        /platform/SUNW,Netra-T12/lib/libc_psr.so.1
        /platform/SUNW,Netra-T12/lib/libmd_psr.so.1

$ nm /appl/local/python-2.7.10/lib/libncurses.so.6 | grep unctrl
0004acac T unctrl
00067540 r unctrl_blob.5717
00067440 r unctrl_c1.5716
0004aac0 T unctrl_sp
00067942 r unctrl_table.5715


Unfortunately I see this in /usr/ccs/lib/libcurses.so
$ nm /usr/ccs/lib/libcurses.so | grep unctrl
0003d5e8 D _unctrl
0000cb00 T unctrl


I don't see any reference to unctrl except this: 
./Modules/_cursesmodule.c:        knp = unctrl(rtn);
./Modules/_cursesmodule.c:    return PyString_FromString(unctrl(ch));
./Modules/_cursesmodule.c:    {"unctrl",              (PyCFunction)PyCurses_UnCtrl, METH_VARARGS},

none of which is referencing _unctrl

so it seems that python can never work with ncurses6...even though it seems there is support for it in the code.

Any help?
msg258993 - (view) Author: R. Jones (jonesrw) Date: 2016-01-27 03:15
Note:  This issue is on Solaris 10 using GCC 4.7.2 and the Solaris linker "ld".
msg259230 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-01-30 01:59
The tracker is not a help forum.  It is for patching CPython.  You might do better to ask for help in python-list or Stackoverflow or elsewhere to try to determine whether you need to do something different or if the problem is with Solaris or if indeed CPython needs to be patched somewhere.
msg372419 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2020-06-26 10:00
Python 2 is EOL, so I think this issue should be closed.
History
Date User Action Args
2022-04-11 14:58:26adminsetgithub: 70400
2020-07-06 07:45:04terry.reedysetstatus: open -> closed
resolution: out of date
stage: resolved
2020-06-26 10:00:04ZackerySpytzsetnosy: + ZackerySpytz
messages: + msg372419
2016-01-30 01:59:54terry.reedysetnosy: + jcea, terry.reedy
messages: + msg259230
2016-01-27 03:15:42jonesrwsetmessages: + msg258993
title: Python with ncurses6.0 will not load _curses module. -> Python with ncurses6.0 will not load _curses module on Solaris 10
2016-01-26 23:40:33jonesrwcreate