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.

classification
Title: Build of posixshmem.c should probe for required OS functions
Type: enhancement Stage: resolved
Components: Build Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: davin Nosy List: davin, nascheme, ronaldoussoren
Priority: normal Keywords: patch

Created on 2019-02-05 22:50 by nascheme, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11765 merged nascheme, 2019-02-05 22:52
PR 11765 merged nascheme, 2019-02-05 22:52
PR 11765 merged nascheme, 2019-02-05 22:52
Messages (6)
msg334888 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2019-02-05 22:50
The logic in setup.py that determines if _multiprocessing/posixshmem.c should get built is not very robust.  I think it is better to use autoconfig to probe for the required functions and libraries.  My autoconfig brain cells are a bit fuzzy but I think my patch is correct.

I look for shm_open and shm_unlink.  I also check if librt is required for these functions.
msg334900 - (view) Author: Davin Potts (davin) * (Python committer) Date: 2019-02-06 03:17
Agreed that the logic for building that code needs exactly this sort of change.  Thanks for the patch!

It looks like your patch does not happily detect the dependencies on MacOS for some reason, but all appears well on Windows & Linux.  I will have a closer look in the morning on a MacOS system.
msg334901 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2019-02-06 04:03
I didn't understand autoconfig well enough but I think I fixed it now.  Apparently MacOS is a platform where it has shm_open but you don't need to link with -lrt.  The revised 'configure' should handle that correctly now.
msg334907 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2019-02-06 08:48
@Neil: On what version of macOS did you test? 

On 10.14.3 with Xcode 10.1 shm_open is in libSystem (that's named libc on most other unixy systems) and there is no library named librt.
msg334981 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2019-02-06 20:28
Hi Ronald,
I tested with my MacBook but I'm not sure what version of the OS.  Probably the latest but I can check when I get home.  Maybe my comment was not clear. On my MacBook, you don't need librt for shm_open, etc.  That sounds like it is the same as your 10.14.3.

AC_SEARCH_LIBS is the macro I'm using to find if I need to link with librt.  It is a bit hard to use though.  It will execute the true clause if the function doesn't require any of the specified libraries.  That seems to be the case for MacOS.  It also adds -lrt to LIBS and so I have to undo that.

I'm using $ac_cv_search_shm_open test if -lrt is actually needed.
msg335103 - (view) Author: Neil Schemenauer (nascheme) * (Python committer) Date: 2019-02-08 18:48
New changeset 5741c45acf9b0ce22ff0dbf56322fe0ff16cfcfc by Neil Schemenauer in branch 'master':
bpo-35903: Use autoconfig to probe for shm_open() and shm_unlink(). (#11765)
https://github.com/python/cpython/commit/5741c45acf9b0ce22ff0dbf56322fe0ff16cfcfc
History
Date User Action Args
2022-04-11 14:59:10adminsetgithub: 80084
2019-02-08 18:55:31naschemesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-02-08 18:48:50naschemesetmessages: + msg335103
2019-02-06 20:28:38naschemesetmessages: + msg334981
2019-02-06 08:48:23ronaldoussorensetnosy: + ronaldoussoren
messages: + msg334907
2019-02-06 04:03:25naschemesetmessages: + msg334901
2019-02-06 03:17:29davinsetmessages: + msg334900
2019-02-05 22:52:09naschemesetpull_requests: + pull_request11721
2019-02-05 22:52:05naschemesetpull_requests: + pull_request11720
2019-02-05 22:52:01naschemesetpull_requests: + pull_request11719
2019-02-05 22:50:22naschemecreate