D'Arcy Cain wrote: > On 2018-07-13 08:05 AM, Peter Otten wrote: >> D'Arcy Cain wrote: >>> Nope. Both are 64 bit. >> >> Just to be 100% sure, what does >> >> $ python2.7 -c 'import struct; print(struct.calcsize("l"))' >> >> $ python3.6 -c 'import struct; print(struct.calcsize("l"))' >> >> print? > > $ python2.7 -c 'import struct; print(struct.calcsize("l"))' > 8 > $ python3.6 -c 'import struct; print(struct.calcsize("l"))' > 8 > >> If both print 8, what is sys.platform? (This is just that I can look at >> the right branch of the ctypes.util source for differences)? > > $ python2.7 -c 'import sys; print(sys.platform)' > netbsd7 > $ python3.6 -c 'import sys; print(sys.platform)' > netbsd7 > > Thanks for checking this.
As far as I can see -- without having access to a netbsd machine -- this leads to the standard 'posix' implementation of find_library() which in both Python 2 and 3 runs /sbin/ldconfig and then searches its output with a regex. On my (linux) machine that regex is the same for both python 2.7 and 3.6: $ python3.6 -c 'import sys; sys.platform="netbsd7"; from ctypes import util; print(util.find_library("cairo"))' XXX b'\\s+(libcairo\\.[^\\s]+)\\s+\\(libc6,x86-64' libcairo.so.2 $ python2.7 -c 'import sys; sys.platform="netbsd7"; from ctypes import util; print(util.find_library("cairo"))' YYY '\\s+(libcairo\\.[^\\s]+)\\s+\\(libc6,x86-64' libcairo.so.2 Given the implementation def find_library(name): return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name)) you might try calling _findSoname_ldconfig() directly -- if it fails for both 2.7 and 3.6 the next step would be to have a look at the fallback. -- https://mail.python.org/mailman/listinfo/python-list