New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken ctypes dependency scanning on Kivy #5734
Comments
Hmm, I saw this with libc too. There's a bug in Python's ctypes itself which I've been meaning to report but I need to find a docker image it can be reproduced on because it doesn't happen on most Linuxes. It should silently return None and move on. >>> from ctypes.util import find_library
>>> find_library("libc.so")
>>> find_library("libc")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/brenainn/.pyenv/versions/3.9.1/lib/python3.9/ctypes/util.py", line 330, in find_library
_get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))
File "/home/brenainn/.pyenv/versions/3.9.1/lib/python3.9/ctypes/util.py", line 147, in _findLib_gcc
if not _is_elf(file):
File "/home/brenainn/.pyenv/versions/3.9.1/lib/python3.9/ctypes/util.py", line 99, in _is_elf
with open(filename, 'br') as thefile:
FileNotFoundError: [Errno 2] No such file or directory: b'liblibc.a' I've only been able to reproduce this on Manjaro linux. Can I have your full platform name? i.e. |
Hmm, on Fedora (python 3.9.2) calling @bwoodsend, can you try running |
brenainn@Ostrich-manjaro /e/n/pyinstaller (cross-compile-freebsd)> gcc -Wl,-t -o prog_tmp -llibc
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/Scrt1.o
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/crti.o
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/crtbeginS.o
/usr/bin/ld: cannot find -llibc
/usr/bin/ld: note to link with /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/libc.a use -l:libc.a or rename it to liblibc.a
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libgcc.a
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/libgcc_s.so
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/libgcc_s.so.1
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libgcc.a
collect2: error: ld returned 1 exit status |
Aha, so it's compiler-dependent. This diagnostic note:
is being matched by regex in |
I think the best way to deal with this is to simply enclose the We could also perform some additional checks on the library names and skip incompatible ones for particular OS (e.g., |
Yeah, I'll do this now.
Except on Alpine. For some reason the suffix is mandatory there: brenainn@Ostrich-manjaro /e/n/pyinstaller $ docker run -it python:3.9.0-alpine
Python 3.9.0 (default, Nov 25 2020, 02:36:55)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.CDLL("libc")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: Error loading shared library libc: No such file or directory
>>> ctypes.CDLL("libc.so")
<CDLL 'libc.so', handle 7fc69d0a3b40 at 0x7fc69cb78a30>
>>> ctypes.CDLL("libm")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: Error loading shared library libm: No such file or directory
>>> ctypes.CDLL("libm.so")
<CDLL 'libm.so', handle 7fc69d0a3b40 at 0x7fc69cb78a60> |
Ah, right, our ctype-handling codepath is catering to both |
…yinstaller#5734) On some Linux C compiler combinations: ctypes.util.find_library("libc.so") Unintentionally trips a FileNotFoundError instead of simply returning None. Fixes pyinstaller#5734.
+++ ONLY TEXT +++ DO NOT POST IMAGES +++
Description of the issue
kivy.clock contains a reference to
libc.dylib
which isn't ignored on Linux-based systems. Due to a recent change in Python, looking for libc viactypes.util.find_library('libc')
will cause an exception to be thrown and stops the build process. Add a try...except block around this find_library call works around the issue but there will still be a warning about it can't find libc.dylib.Context information (for bug reports)
pyinstaller --version
:5.0.dev0
(7d77825)No but should still work on Windows since PyInstaller excludes all *.dylib on that platform, and on OSX for obvious reasons.
(https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and
Make sure everything is packaged correctly
--noupx
or setupx=False
in your .spec-file--debug
topyi-makespec
orpyinstaller
or useEXE(..., debug=1, ...)
in your .spec file.A minimal example program which shows the error
Any kivy example program on Python 3.9 should be able to reproduce this issue.
Stacktrace / full error message
Please also see https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs
for more about what would use to solve the issue.
The text was updated successfully, but these errors were encountered: