Solved Python38 failing with readline.cpython-38.so:No such file or directory

One of my jails is failing to build lang/phtyon38 and is failing with

Code:
install  -m 0644 ./Misc/python.man  /var/ports/usr/ports/lang/python38/work/stage/usr/local/man/man1/python3.8.1
if test "xno" != "xno"  ; then  case no in  upgrade) ensurepip="--altinstall --upgrade" ;;  install|*) ensurepip="--altinstall" ;;  esac;  LD_LIBRARY_PATH=/var/ports/usr/ports/lang/python38/work/Python-3.8.10 ./python -E -m ensurepip  $ensurepip --root=/var/ports/usr/ports/lang/python38/work/stage/ ;  fi
/bin/rm -f /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/libpython3.so                                            # Upstream Issue: https://bugs.python.org/issue17975
for i in /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib-dynload/*.so; do  /usr/bin/strip $i; done                                                            # Strip shared extensions
install  -m 0644 /var/ports/usr/ports/lang/python38/work/Python-3.8.10/Tools/gdb/libpython.py  /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/libpython3.8.so.1.0-gdb.py
====> Compressing man pages (compress-man)
===>  Installing for python38-3.8.10
===>  Checking if python38 is already installed
actual-package-depends: dependency on /lib/libreadline.so.8 not registered (normal if it belongs to base)
===>   Registering installation for python38-3.8.10
pkg-static: Unable to access file /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib-dynload/readline.cpython-38.so:No such file or directory
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/python38

It appears there is an attempt to build the library but if fails.

Code:
 # ls -lah /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib-dynload/readl*
-rwxr-xr-x  1 root  wheel    29K May 31 10:15 /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib-dynload/readline.cpython-38_failed.so

I tried rebuilding the base jail per 71578 which doesn't seem to have made a difference. Someone seems to be having a similar issue with a Raspberry Pi: 80461 but no answer - perhaps the same issue.

building with /usr/ports/lang/python38 # make clean && make distclean && make install clean | grep readline filters the output to some possibly relevant details:

Code:
configure: WARNING: --with(out)-system-ffi is ignored on this platform
checking how to link readline libs... -lreadline
checking for rl_pre_input_hook in -lreadline... yes
checking for rl_completion_display_matches_hook in -lreadline... yes
checking for rl_resize_terminal in -lreadline... yes
checking for rl_completion_matches in -lreadline... yes
checking for append_history in -lreadline... yes
--- Parser/myreadline.o ---
--- Parser/myreadline.o ---
cc -pthread -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -Oz -pipe -march=barcelona -mtune=barcelona  -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I./Include/internal  -I. -I./Include -I/usr/local/include -I/usr/local/include -fPIC -DPy_BUILD_CORE -o Parser/myreadline.o Parser/myreadline.c
if test libpython3.8.so.1.0 != libpython3.8.so; then  cc -pthread -shared  -L/usr/local/lib  -fstack-protector-strong    -Wl,-hlibpython3.8.so.1.0 -o libpython3.8.so.1.0 Modules/getbuildinfo.o  Parser/acceler.o  Parser/grammar1.o  Parser/listnode.o  Parser/node.o  Parser/parser.o  Parser/token.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o  Objects/abstract.o  Objects/accu.o  Objects/boolobject.o  Objects/bytes_methods.o  Objects/bytearrayobject.o  Objects/bytesobject.o  Objects/call.o  Objects/capsule.o  Objects/cellobject.o  Objects/classobject.o  Objects/codeobject.o  Objects/complexobject.o  Objects/descrobject.o  Objects/enumobject.o  Objects/exceptions.o  Objects/genobject.o  Objects/fileobject.o  Objects/floatobject.o  Objects/frameobject.o  Objects/funcobject.o  Objects/interpreteridobject.o  Objects/iterobject.o  Objects/listobject.o  Objects/longobject.o  Objects/dictobject.o  Objects/odictobject.o  Objects/memoryobject.o  Objects/methodobject.o  Objects/moduleobject.o  Objects/namespaceobject.o  Objects/object.o  Objects/obmalloc.o  Objects/picklebufobject.o  Objects/rangeobject.o  Objects/setobject.o  Objects/sliceobject.o  Objects/structseq.o  Objects/tupleobject.o  Objects/typeobject.o  Objects/unicodeobject.o  Objects/unicodectype.o  Objects/weakrefobject.o  Python/_warnings.o  Python/Python-ast.o  Python/asdl.o  Python/ast.o  Python/ast_opt.o  Python/ast_unparse.o  Python/bltinmodule.o  Python/ceval.o  Python/codecs.o  Python/compile.o  Python/context.o  Python/dynamic_annotations.o  Python/errors.o  Python/frozenmain.o  Python/future.o  Python/getargs.o  Python/getcompiler.o  Python/getcopyright.o  Python/getplatform.o  Python/getversion.o  Python/graminit.o  Python/hamt.o  Python/import.o  Python/importdl.o  Python/initconfig.o  Python/marshal.o  Python/modsupport.o  Python/mysnprintf.o  Python/mystrtoul.o  Python/pathconfig.o  Python/peephole.o  Python/preconfig.o  Python/pyarena.o  Python/pyctype.o  Python/pyfpe.o  Python/pyhash.o  Python/pylifecycle.o  Python/pymath.o  Python/pystate.o  Python/pythonrun.o  Python/pytime.o  Python/bootstrap_hash.o  Python/structmember.o  Python/symtable.o  Python/sysmodule.o  Python/thread.o  Python/traceback.o  Python/getopt.o  Python/pystrcmp.o  Python/pystrtod.o  Python/pystrhex.o  Python/dtoa.o  Python/formatter_unicode.o  Python/fileutils.o  Python/dynload_shlib.o        Modules/config.o  Modules/getpath.o  Modules/main.o  Modules/gcmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.o  Python/frozen.o   -lcrypt -lintl -ldl -L/usr/local/lib -lintl -lutil -lm  -lm;  ln -f libpython3.8.so.1.0 libpython3.8.so;  else  cc -pthread -shared  -L/usr/local/lib  -fstack-protector-strong    -o libpython3.8.so Modules/getbuildinfo.o  Parser/acceler.o  Parser/grammar1.o  Parser/listnode.o  Parser/node.o  Parser/parser.o  Parser/token.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o  Objects/abstract.o  Objects/accu.o  Objects/boolobject.o  Objects/bytes_methods.o  Objects/bytearrayobject.o  Objects/bytesobject.o  Objects/call.o  Objects/capsule.o  Objects/cellobject.o  Objects/classobject.o  Objects/codeobject.o  Objects/complexobject.o  Objects/descrobject.o  Objects/enumobject.o  Objects/exceptions.o  Objects/genobject.o  Objects/fileobject.o  Objects/floatobject.o  Objects/frameobject.o  Objects/funcobject.o  Objects/interpreteridobject.o  Objects/iterobject.o  Objects/listobject.o  Objects/longobject.o  Objects/dictobject.o  Objects/odictobject.o  Objects/memoryobject.o  Objects/methodobject.o  Objects/moduleobject.o  Objects/namespaceobject.o  Objects/object.o  Objects/obmalloc.o  Objects/picklebufobject.o  Objects/rangeobject.o  Objects/setobject.o  Objects/sliceobject.o  Objects/structseq.o  Objects/tupleobject.o  Objects/typeobject.o  Objects/unicodeobject.o  Objects/unicodectype.o  Objects/weakrefobject.o  Python/_warnings.o  Python/Python-ast.o  Python/asdl.o  Python/ast.o  Python/ast_opt.o  Python/ast_unparse.o  Python/bltinmodule.o  Python/ceval.o  Python/codecs.o  Python/compile.o  Python/context.o  Python/dynamic_annotations.o  Python/errors.o  Python/frozenmain.o  Python/future.o  Python/getargs.o  Python/getcompiler.o  Python/getcopyright.o  Python/getplatform.o  Python/getversion.o  Python/graminit.o  Python/hamt.o  Python/import.o  Python/importdl.o  Python/initconfig.o  Python/marshal.o  Python/modsupport.o  Python/mysnprintf.o  Python/mystrtoul.o  Python/pathconfig.o  Python/peephole.o  Python/preconfig.o  Python/pyarena.o  Python/pyctype.o  Python/pyfpe.o  Python/pyhash.o  Python/pylifecycle.o  Python/pymath.o  Python/pystate.o  Python/pythonrun.o  Python/pytime.o  Python/bootstrap_hash.o  Python/structmember.o  Python/symtable.o  Python/sysmodule.o  Python/thread.o  Python/traceback.o  Python/getopt.o  Python/pystrcmp.o  Python/pystrtod.o  Python/pystrhex.o  Python/dtoa.o  Python/formatter_unicode.o  Python/fileutils.o  Python/dynload_shlib.o        Modules/config.o  Modules/getpath.o  Modules/main.o  Modules/gcmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.o  Python/frozen.o   -lcrypt -lintl -ldl -L/usr/local/lib -lintl -lutil -lm  -lm;  fi
ar rcs libpython3.8.a Modules/getbuildinfo.o  Parser/acceler.o  Parser/grammar1.o  Parser/listnode.o  Parser/node.o  Parser/parser.o  Parser/token.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o  Objects/abstract.o  Objects/accu.o  Objects/boolobject.o  Objects/bytes_methods.o  Objects/bytearrayobject.o  Objects/bytesobject.o  Objects/call.o  Objects/capsule.o  Objects/cellobject.o  Objects/classobject.o  Objects/codeobject.o  Objects/complexobject.o  Objects/descrobject.o  Objects/enumobject.o  Objects/exceptions.o  Objects/genobject.o  Objects/fileobject.o  Objects/floatobject.o  Objects/frameobject.o  Objects/funcobject.o  Objects/interpreteridobject.o  Objects/iterobject.o  Objects/listobject.o  Objects/longobject.o  Objects/dictobject.o  Objects/odictobject.o  Objects/memoryobject.o  Objects/methodobject.o  Objects/moduleobject.o  Objects/namespaceobject.o  Objects/object.o  Objects/obmalloc.o  Objects/picklebufobject.o  Objects/rangeobject.o  Objects/setobject.o  Objects/sliceobject.o  Objects/structseq.o  Objects/tupleobject.o  Objects/typeobject.o  Objects/unicodeobject.o  Objects/unicodectype.o  Objects/weakrefobject.o  Python/_warnings.o  Python/Python-ast.o  Python/asdl.o  Python/ast.o  Python/ast_opt.o  Python/ast_unparse.o  Python/bltinmodule.o  Python/ceval.o  Python/codecs.o  Python/compile.o  Python/context.o  Python/dynamic_annotations.o  Python/errors.o  Python/frozenmain.o  Python/future.o  Python/getargs.o  Python/getcompiler.o  Python/getcopyright.o  Python/getplatform.o  Python/getversion.o  Python/graminit.o  Python/hamt.o  Python/import.o  Python/importdl.o  Python/initconfig.o  Python/marshal.o  Python/modsupport.o  Python/mysnprintf.o  Python/mystrtoul.o  Python/pathconfig.o  Python/peephole.o  Python/preconfig.o  Python/pyarena.o  Python/pyctype.o  Python/pyfpe.o  Python/pyhash.o  Python/pylifecycle.o  Python/pymath.o  Python/pystate.o  Python/pythonrun.o  Python/pytime.o  Python/bootstrap_hash.o  Python/structmember.o  Python/symtable.o  Python/sysmodule.o  Python/thread.o  Python/traceback.o  Python/getopt.o  Python/pystrcmp.o  Python/pystrtod.o  Python/pystrhex.o  Python/dtoa.o  Python/formatter_unicode.o  Python/fileutils.o  Python/dynload_shlib.o        Modules/config.o  Modules/getpath.o  Modules/main.o  Modules/gcmodule.o  Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.o  Python/frozen.o
In file included from /var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.c:31:
In file included from /usr/local/include/readline/readline.h:36:
/usr/local/include/readline/rltypedefs.h:35:22: warning: this function declaration is not a prototype [-Wstrict-prototypes]
/usr/local/include/readline/rltypedefs.h:36:24: warning: this function declaration is not a prototype [-Wstrict-prototypes]
/usr/local/include/readline/rltypedefs.h:37:26: warning: this function declaration is not a prototype [-Wstrict-prototypes]
/usr/local/include/readline/rltypedefs.h:38:28: warning: this function declaration is not a prototype [-Wstrict-prototypes]
In file included from /var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.c:31:
/usr/local/include/readline/readline.h:408:23: warning: this function declaration is not a prototype [-Wstrict-prototypes]
*** WARNING: renaming "readline" since importing it failed: /var/ports/usr/ports/lang/python38/work/Python-3.8.10/build/lib.freebsd-11.3-RELEASE-p8-amd64-3.8/readline.cpython-38.so: Undefined symbol "rl_callback_sigcleanup"
readline
In file included from /var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.c:31:
In file included from /usr/local/include/readline/readline.h:36:
/usr/local/include/readline/rltypedefs.h:35:22: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef int Function () __attribute__ ((deprecated));
                     ^
                      void
/usr/local/include/readline/rltypedefs.h:36:24: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef void VFunction () __attribute__ ((deprecated));
                       ^
                        void
/usr/local/include/readline/rltypedefs.h:37:26: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef char *CPFunction () __attribute__ ((deprecated));
                         ^
                          void
/usr/local/include/readline/rltypedefs.h:38:28: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef char **CPPFunction () __attribute__ ((deprecated));
                           ^
                            void
In file included from /var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.c:31:
/usr/local/include/readline/readline.h:408:23: warning: this function declaration is not a prototype [-Wstrict-prototypes]
extern int rl_message ();
                      ^
                       void
5 warnings generated.
*** WARNING: renaming "readline" since importing it failed: /var/ports/usr/ports/lang/python38/work/Python-3.8.10/build/lib.freebsd-11.3-RELEASE-p8-amd64-3.8/readline.cpython-38.so: Undefined symbol "rl_callback_sigcleanup"
readline
install -m 0644 ./Lib/test/test_readline.py /usr/local/lib/python3.8/test
install -m 0644 ./Lib/lib2to3/fixes/fix_xreadlines.py /usr/local/lib/python3.8/lib2to3/fixes
Compiling '/var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib2to3/fixes/fix_xreadlines.py'...
Compiling '/var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/test/test_readline.py'...
Compiling '/var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib2to3/fixes/fix_xreadlines.py'...
Compiling '/var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/test/test_readline.py'...
Compiling '/var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib2to3/fixes/fix_xreadlines.py'...
Compiling '/var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/test/test_readline.py'...
building 'readline' extension
cc -fPIC -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -Oz -pipe -march=barcelona -mtune=barcelona -march=amdfam10 -fstack-protector-strong -fno-strict-aliasing -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -I./Include/internal -I./Include -I. -I/usr/local/include -I/var/ports/usr/ports/lang/python38/work/Python-3.8.10/Include -I/var/ports/usr/ports/lang/python38/work/Python-3.8.10 -c /var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.c -o build/temp.freebsd-11.3-RELEASE-p8-amd64-3.8/var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.o
In file included from /var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.c:31:
In file included from /usr/local/include/readline/readline.h:36:
/usr/local/include/readline/rltypedefs.h:35:22: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef int Function () __attribute__ ((deprecated));
                     ^
                      void
/usr/local/include/readline/rltypedefs.h:36:24: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef void VFunction () __attribute__ ((deprecated));
                       ^
                        void
/usr/local/include/readline/rltypedefs.h:37:26: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef char *CPFunction () __attribute__ ((deprecated));
                         ^
                          void
/usr/local/include/readline/rltypedefs.h:38:28: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef char **CPPFunction () __attribute__ ((deprecated));
                           ^
                            void
In file included from /var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.c:31:
/usr/local/include/readline/readline.h:408:23: warning: this function declaration is not a prototype [-Wstrict-prototypes]
extern int rl_message ();
                      ^
                       void
5 warnings generated.
cc -pthread -shared -L/usr/local/lib -fstack-protector-strong -L/usr/local/lib -fstack-protector-strong -Oz -pipe -march=barcelona -mtune=barcelona -march=amdfam10 -fstack-protector-strong -fno-strict-aliasing -I/usr/local/include -I/usr/local/include build/temp.freebsd-11.3-RELEASE-p8-amd64-3.8/var/ports/usr/ports/lang/python38/work/Python-3.8.10/Modules/readline.o -L/usr/lib/termcap -L. -L/usr/local/lib -lreadline -o build/lib.freebsd-11.3-RELEASE-p8-amd64-3.8/readline.cpython-38.so
*** WARNING: renaming "readline" since importing it failed: /var/ports/usr/ports/lang/python38/work/Python-3.8.10/build/lib.freebsd-11.3-RELEASE-p8-amd64-3.8/readline.cpython-38.so: Undefined symbol "rl_callback_sigcleanup"
readline
copying build/lib.freebsd-11.3-RELEASE-p8-amd64-3.8/readline.cpython-38_failed.so -> /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib-dynload
changing mode of /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib-dynload/readline.cpython-38_failed.so to 755
actual-package-depends: dependency on /lib/libreadline.so.8 not registered (normal if it belongs to base)
pkg-static: Unable to access file /var/ports/usr/ports/lang/python38/work/stage/usr/local/lib/python3.8/lib-dynload/readline.cpython-38.so:No such file or directory
 
Thanks Alain!

I usually only do that for variations from default so I don't inadvertently stick at an old version, but I thought to try it and saw I had left ssl=base and set that to
Code:
DEFAULT_VERSIONS+= ssl=openssl

and that seemed to resolve it. I wouldn't have checked if you hadn't suggested the make.conf modification.
 
Just note - it's usually caused by old base libreadline hanging around (it was removed from base long time ago).
cleanup with cd /usr/src && make delete-old-libs
 
I've ran into the same issue and found this in python's build log:

Code:
1 warning generated.
*** WARNING: renaming "readline" since importing it failed: Shared object "libncursesw.so.8" not found, required by "libreadline.so.8"

I've managed to fix it by:
# cd /usr/lib
# ln -s libncursesw.so libncursesw.so.8

UPDATE:
I've just found out that misc/compat12x provides this shared library, so it's better to install this port than to create a symlink.

Hope this helps.
 
Back
Top