Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building with a libreadline.so located outside the ld.so.conf search path fails #84827

Closed
mjpieters mannequin opened this issue May 16, 2020 · 3 comments
Closed

Building with a libreadline.so located outside the ld.so.conf search path fails #84827

mjpieters mannequin opened this issue May 16, 2020 · 3 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes build The build process and cross-build extension-modules C modules in the Modules dir

Comments

@mjpieters
Copy link
Mannequin

mjpieters mannequin commented May 16, 2020

BPO 40647
Nosy @mjpieters

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2020-05-16.15:27:30.017>
labels = ['3.7', '3.8', '3.9', 'extension-modules', 'build', 'invalid']
title = 'Building with a libreadline.so located outside the ld.so.conf search path fails'
updated_at = <Date 2020-05-16.15:54:44.614>
user = 'https://github.com/mjpieters'

bugs.python.org fields:

activity = <Date 2020-05-16.15:54:44.614>
actor = 'mjpieters'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Extension Modules']
creation = <Date 2020-05-16.15:27:30.017>
creator = 'mjpieters'
dependencies = []
files = []
hgrepos = []
issue_num = 40647
keywords = []
message_count = 3.0
messages = ['369054', '369055', '369057']
nosy_count = 1.0
nosy_names = ['mjpieters']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'open'
superseder = None
type = 'compile error'
url = 'https://bugs.python.org/issue40647'
versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

@mjpieters
Copy link
Mannequin Author

mjpieters mannequin commented May 16, 2020

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))

@mjpieters mjpieters mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes extension-modules C modules in the Modules dir build The build process and cross-build labels May 16, 2020
@mjpieters
Copy link
Mannequin Author

mjpieters mannequin commented May 16, 2020

Actually, this won't do it either, as self.lib_dirs already contains the --prefix.

Clearly, I just need to add -R=${PREFIX}/lib to CPPFLAGS.

@mjpieters mjpieters mannequin added invalid labels May 16, 2020
@mjpieters
Copy link
Mannequin Author

mjpieters mannequin commented May 16, 2020

Last but not least, this is essentially a duplicate of https://bugs.python.org/issue4010

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@kumaraditya303 kumaraditya303 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes build The build process and cross-build extension-modules C modules in the Modules dir
Projects
None yet
Development

No branches or pull requests

1 participant