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.

Title: distutil's runtime_library_dir (rpath) option doesn't work with clang
Type: behavior Stage: needs patch
Components: Distutils Versions: Python 3.11, Python 3.10, Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: FFY00, chaz6, christian.heimes, dstufft, eric.araujo, miss-islington
Priority: normal Keywords: patch

Created on 2021-10-05 09:00 by christian.heimes, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 28732 merged christian.heimes, 2021-10-05 09:06
PR 28733 merged miss-islington, 2021-10-05 09:44
PR 28734 merged miss-islington, 2021-10-05 09:44
Messages (8)
msg403204 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-10-05 09:00
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.
msg403205 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-10-05 09:06
$ 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/ | grep RUNPATH
 0x000000000000001d (RUNPATH)            Library runpath: [/home/heimes/dev/python/multissl/openssl/3.0.0/lib]
msg403212 - (view) Author: Chris Hills (chaz6) Date: 2021-10-05 09:41
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!
msg403213 - (view) Author: miss-islington (miss-islington) Date: 2021-10-05 09:43
New changeset ef6196028f966f22d82930b66e1371e75c5df2f7 by Christian Heimes in branch 'main':
bpo-45371: Fix distutils' rpath support for clang (GH-28732)
msg403219 - (view) Author: miss-islington (miss-islington) Date: 2021-10-05 10:04
New changeset 3733dddecaa332966e200718d4993545f8e52247 by Miss Islington (bot) in branch '3.10':
[3.10] bpo-45371: Fix distutils' rpath support for clang (GH-28732) (GH-28733)
msg403220 - (view) Author: miss-islington (miss-islington) Date: 2021-10-05 10:09
New changeset 3ce5e07e9a4b78302b69f898527396ff7b5fd448 by Miss Islington (bot) in branch '3.9':
bpo-45371: Fix distutils' rpath support for clang (GH-28732)
msg403221 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-10-05 10:12
Thanks for confirming that the fix works for you. The fix will be in 3.10.1, which should be released in early December.
msg403307 - (view) Author: Filipe Laíns (FFY00) * (Python triager) Date: 2021-10-06 14:56
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.

Date User Action Args
2022-04-11 14:59:50adminsetgithub: 89534
2021-10-06 14:56:22FFY00setnosy: + FFY00
messages: + msg403307
2021-10-06 12:10:07christian.heimessetstatus: closed -> open
resolution: fixed ->
stage: resolved -> needs patch
2021-10-05 10:12:37christian.heimessetstatus: open -> closed
resolution: fixed
messages: + msg403221

stage: patch review -> resolved
2021-10-05 10:09:24miss-islingtonsetmessages: + msg403220
2021-10-05 10:04:55miss-islingtonsetmessages: + msg403219
2021-10-05 09:44:12miss-islingtonsetpull_requests: + pull_request27082
2021-10-05 09:44:08miss-islingtonsetpull_requests: + pull_request27081
2021-10-05 09:43:50miss-islingtonsetnosy: + miss-islington
messages: + msg403213
2021-10-05 09:41:03chaz6setnosy: + chaz6
messages: + msg403212
2021-10-05 09:06:36christian.heimessetmessages: + msg403205
2021-10-05 09:06:21christian.heimessetkeywords: + patch
stage: patch review
pull_requests: + pull_request27080
2021-10-05 09:00:35christian.heimescreate