Navigation Menu

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

distutil's runtime_library_dir (rpath) option doesn't work with clang #89534

Closed
tiran opened this issue Oct 5, 2021 · 10 comments
Closed

distutil's runtime_library_dir (rpath) option doesn't work with clang #89534

tiran opened this issue Oct 5, 2021 · 10 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@tiran
Copy link
Member

tiran commented Oct 5, 2021

BPO 45371
Nosy @tiran, @merwok, @dstufft, @miss-islington, @FFY00
PRs
  • bpo-45371: Fix distutils' rpath support for clang #28732
  • [3.10] bpo-45371: Fix distutils' rpath support for clang (GH-28732) #28733
  • [3.9] bpo-45371: Fix distutils' rpath support for clang (GH-28732) #28734
  • 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 2021-10-05.09:00:35.282>
    labels = ['type-bug', 'library', '3.9', '3.10', '3.11']
    title = "distutil's runtime_library_dir (rpath) option doesn't work with clang"
    updated_at = <Date 2021-10-06.14:56:22.176>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2021-10-06.14:56:22.176>
    actor = 'FFY00'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Distutils']
    creation = <Date 2021-10-05.09:00:35.282>
    creator = 'christian.heimes'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45371
    keywords = ['patch']
    message_count = 8.0
    messages = ['403204', '403205', '403212', '403213', '403219', '403220', '403221', '403307']
    nosy_count = 6.0
    nosy_names = ['christian.heimes', 'eric.araujo', 'chaz6', 'dstufft', 'miss-islington', 'FFY00']
    pr_nums = ['28732', '28733', '28734']
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45371'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @tiran
    Copy link
    Member Author

    tiran commented Oct 5, 2021

    Chris Hills reported in bpo-43466 that the new --with-openssl-rpath=auto does not work with clang. It turns out to be a bug in distutils. UnixCCompiler.runtime_library_dir_option() does not detect clang correctly and emits wrong option for rpath.

    @tiran tiran added 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 5, 2021
    @tiran
    Copy link
    Member Author

    tiran commented Oct 5, 2021

    $ CC=clang ./configure --with-openssl=/home/heimes/dev/python/multissl/openssl/3.0.0 --with-openssl-rpath=auto
    $ make
    $ readelf -d build/lib.linux-x86_64-3.11/_ssl.cpython-311-x86_64-linux-gnu.so | grep RUNPATH
     0x000000000000001d (RUNPATH)            Library runpath: [/home/heimes/dev/python/multissl/openssl/3.0.0/lib]

    @chaz6
    Copy link
    Mannequin

    chaz6 mannequin commented Oct 5, 2021

    I tested this both with and without LDFLAGS="-Wl,-rpath -Wl,/home/chaz/.local/local/python3.10.0/lib", and in both cases this patch works as expected. Thank you!

    @miss-islington
    Copy link
    Contributor

    New changeset ef61960 by Christian Heimes in branch 'main':
    bpo-45371: Fix distutils' rpath support for clang (GH-28732)
    ef61960

    @miss-islington
    Copy link
    Contributor

    New changeset 3733ddd by Miss Islington (bot) in branch '3.10':
    [3.10] bpo-45371: Fix distutils' rpath support for clang (GH-28732) (GH-28733)
    3733ddd

    @miss-islington
    Copy link
    Contributor

    New changeset 3ce5e07 by Miss Islington (bot) in branch '3.9':
    bpo-45371: Fix distutils' rpath support for clang (GH-28732)
    3ce5e07

    @tiran
    Copy link
    Member Author

    tiran commented Oct 5, 2021

    Thanks for confirming that the fix works for you. The fix will be in 3.10.1, which should be released in early December.

    @tiran tiran closed this as completed Oct 5, 2021
    @tiran tiran closed this as completed Oct 5, 2021
    @tiran tiran reopened this Oct 6, 2021
    @tiran tiran reopened this Oct 6, 2021
    @FFY00
    Copy link
    Member

    FFY00 commented Oct 6, 2021

    The fix that was merged seems a bit hacky to me -- it changes the _is_gcc check so that it returns True on clang.

    Even though distutils is deprecated and no longer synced externally, if someone needs to issue a similar fix, this might trip them over.

    I would recommend replacing it with [1], from the now externally maintained distutils module.

    [1] pypa/distutils#55

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @AA-Turner
    Copy link
    Member

    @FFY00 -- can this be closed? I don't believe it has been changed, but I also can't find any record of further discussion.

    A

    @AA-Turner AA-Turner added the pending The issue will be closed if no feedback is provided label Jun 9, 2022
    @FFY00
    Copy link
    Member

    FFY00 commented Jun 9, 2022

    I think it can, AFAIK there was no further discussion.

    @FFY00 FFY00 closed this as completed Jun 9, 2022
    @AA-Turner AA-Turner removed the pending The issue will be closed if no feedback is provided label Jun 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants