New submission from Martijn Pieters <m...@python.org>:

This issue goes back a long time. The libreadline handling in the modules 
setup.py doesn't add the location of the readline library to the runtime 
library paths:

    self.add(Extension('readline', ['readline.c'],
                       library_dirs=['/usr/lib/termcap'],
                       extra_link_args=readline_extra_link_args,
                       libraries=readline_libs))

This requires the readline library to have been added to a traditional location 
or has taken care of either ld.so.conf or LD_LIBRARY_PATH.

I'm building a series of Python binaries with a custom `--prefix` where I also 
installed a local copy of readline (so both are configured with the same 
prefix), and while setup.py finds the correct library, importing the compiled 
result fails because no `RPATH` is set.

This could be fixed by adding the parent path of the located `libreadline` 
shared library as a `runtime_library_dirs` entry:

    readline_libdirs = None
    if do_readline not in self.lib_dirs:
        readline_libdirs = [
            os.path.abspath(os.path.dirname(do_readline))
        ]

    self.add(Extension('readline', ['readline.c'],
                       library_dirs=['/usr/lib/termcap'],
                       extra_link_args=readline_extra_link_args,
                       runtime_library_dirs=readline_libdirs,
                       libraries=readline_libs))

----------
components: Extension Modules
messages: 369054
nosy: mjpieters
priority: normal
severity: normal
status: open
title: Building with a libreadline.so located outside the ld.so.conf search 
path fails
type: compile error
versions: Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40647>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to