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.
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.
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.
@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.
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.