You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ctypes.util.find_library not working on macOS #77462
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=Noneclosed_at=<Date2018-05-02.02:56:57.992>created_at=<Date2018-04-15.05:24:20.526>labels= ['3.8', 'ctypes', 'type-bug', '3.7']
title='ctypes.util.find_library not working on macOS'updated_at=<Date2018-05-02.02:56:57.989>user='https://github.com/ihaveamac'
On Python 3.7.0a4 and later (including 3.7.0b4), find_library currently always returns None on macOS. It works on 3.7.0a3 and earlier. Tested on macOS 10.11 and 10.13.
Expected result: Tested on 3.6.5, 3.7.0a1 and 3.7.0a3:
Thanks for the report and the good detective work! I see the same results. It appears that the error was introduced by c5ae169 for bpo-26439. It looks we need both a fix and a test for this. This really needs to be fixed for 3.7.0b4.
Thanks for the report and the good detective work! I see the same results. It appears that the error was introduced by c5ae169 for bpo-26439. It looks we need both a fix and a test for this. This really needs to be fixed for 3.7.0b4.
Perhaps he can give a bit more info. I do not understand how this could
break things, as the darwin code is earlier in the queue.
ifos.name=="posix"andsys.platform=="darwin":
fromctypes.macholib.dyldimportdyld_findas_dyld_finddeffind_library(name):
possible= ['lib%s.dylib'%name,
'%s.dylib'%name,
'%s.framework/%s'% (name, name)]
fornameinpossible:
try:
return_dyld_find(name)
exceptValueError:
continuereturnNoneifsys.platform.startswith("aix"):
# AIX has two styles of storing shared libraries# GNU auto_tools refer to these as svr4 and aix# svr4 (System V Release 4) is a regular file, often with .so as suffix# AIX style uses an archive (suffix .a) with members (e.g., shr.o, libssl.so)
# see issue#26439 and _aix.py for more details
from ctypes._aix import find_library
elif os.name == "posix":
# Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
import re, tempfile
def _findLib_gcc(name):
As I understand the code above (and maybe I am wrong) - the code should
be calling the unchanged routines in the macholib subdirectory. A simple
test on macOS would be to comment out the two lines
In other words - can someone check whether the unchanged Lib/ctypes/macholib/* files are being used? And if not, then something
surprising is preventing that. If they are - no idea how the macholib
code got effected by this. The goal was to have all changes in the
_aix.py file, rather than in util.py.
New changeset c74ca53 by Ned Deily (Miss Islington (bot)) in branch '3.7': bpo-33281: Fix ctypes.util.find_library regression on macOS (GH-6625) (GH-6680) c74ca53
Activity
ihaveamac commentedon Apr 15, 2018
On Python 3.7.0a4 and later (including 3.7.0b4), find_library currently always returns None on macOS. It works on 3.7.0a3 and earlier. Tested on macOS 10.11 and 10.13.
Expected result: Tested on 3.6.5, 3.7.0a1 and 3.7.0a3:
Current output on 3.7.0a4 to 3.7.0b3:
ned-deily commentedon Apr 15, 2018
Thanks for the report and the good detective work! I see the same results. It appears that the error was introduced by c5ae169 for bpo-26439. It looks we need both a fix and a test for this. This really needs to be fixed for 3.7.0b4.
aixtools commentedon Apr 25, 2018
On 15/04/2018 07:56, Ned Deily wrote:
Perhaps he can give a bit more info. I do not understand how this could
break things, as the darwin code is earlier in the queue.
from ctypes._aix import find_library
elif os.name == "posix":
# Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
import re, tempfile
def _findLib_gcc(name):
As I understand the code above (and maybe I am wrong) - the code should
be calling the unchanged routines in the macholib subdirectory. A simple
test on macOS would be to comment out the two lines
That will "delete" the AIX find_library logic.
In other words - can someone check whether the unchanged
Lib/ctypes/macholib/* files are being used? And if not, then something
surprising is preventing that. If they are - no idea how the macholib
code got effected by this. The goal was to have all changes in the
_aix.py file, rather than in util.py.
ned-deily commentedon May 2, 2018
New changeset d06d345 by Ned Deily (Ray Donnelly) in branch 'master':
bpo-33281: Fix ctypes.util.find_library regression on macOS (GH-6625)
d06d345
ned-deily commentedon May 2, 2018
New changeset 69a013e by Ned Deily in branch 'master':
bpo-33281: NEWS and ACK (GH-6681)
69a013e
ned-deily commentedon May 2, 2018
New changeset c74ca53 by Ned Deily (Miss Islington (bot)) in branch '3.7':
bpo-33281: Fix ctypes.util.find_library regression on macOS (GH-6625) (GH-6680)
c74ca53
ned-deily commentedon May 2, 2018
New changeset d74f353 by Ned Deily (Miss Islington (bot)) in branch '3.7':
bpo-33281: NEWS and ACK (GH-6681) (GH-6682)
d74f353
ned-deily commentedon May 2, 2018
Thanks for the PR, Ray. Merged for 3.7.0b4 (and 3.8.0).