Open RobertFlatt opened 2 years ago
Turns out kivy-ios needs to use the classic posix find_library()
approach to find libc
and libm
. So the 'darwin' to 'ios' proposal above won't work. But the posix approach does not find a libname.a
built by a kivy-ios recipe.
Current hypothesis is a patch something like this:
--- Python-3.9.9.orig/Lib/ctypes/util.py 2022-04-07 15:30:26.000000000 -1000
+++ Python-3.9.9/Lib/ctypes/util.py 2022-04-07 15:28:49.000000000 -1000
@@ -325,10 +325,23 @@
return result
def find_library(name):
- # See issue #9998
- return _findSoname_ldconfig(name) or \
- _get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))
-
+ if name in ('c', 'm'):
+ # See issue #9998
+ return _findSoname_ldconfig(name) or \
+ _get_soname(_findLib_gcc(name)) or \
+ _get_soname(_findLib_ld(name))
+ else:
+ # >>>Here need to find 'libname.a' <<<<
################################################################
# test code
@misl6 Where do I look to get the path to the app libs
directory on iOS device?
Copying the mach-o file to the project, and patching the loader results in:
./libzbar.a' (file does not start with MH_MAGIC[_64],
file does not start with MH_MAGIC[_64],
fat file, but missing compatible architecture
(have 'x86_64,arm64', need 'arm64e'))
Perhaps the recipe has to build a .dylib
?
Versions
Describe the bug Issue was found with a load time error when
pyzbar
loadslibzbar
, see log below.The fail is due to
ctypes.util.py
invokingsubprocess
to run/sbin/ldconfig
.I think the error message is misleading, because
ctypes/util.py
contains blocks of platform specific code, and is executing the catchall. The catchall because there is one earlier block for'darwin'
but no block for'ios'
.There are two
'darwin'
specific blocks (both assume posix, does iOS claim posix?) https://github.com/python/cpython/blob/main/Lib/ctypes/util.py#L70 https://github.com/python/cpython/blob/main/Lib/ctypes/util.py#L349Hopefully these
'darwin'
cases also cover'ios'
Logs
Additional context
1) Obviously the issue is more general to Python code than
pyzbar
loadinglibzbar
.2) As to other cases, a
grep -R \"darwin\"
ofcpython
finds 48 matches, but very few that look like they might be worth checking.