Open ADR-007 opened 5 years ago
I found a workaround: tarfile.py:
@staticmethod
def _create_header(info, format, encoding, errors):
"""Return a header block. info is a dictionary with file
information, format must be one of the *_FORMAT constants.
"""
parts = [
stn(info.get("name", ""), 100, encoding, errors),
itn(info.get("mode", 0) & 0o7777, 8, format),
itn(info.get("uid", 0) % 256, 8, format), # <-------------------------
itn(info.get("gid", 0) % 256, 8, format), # <-------------------------
itn(info.get("size", 0), 12, format),
itn(info.get("mtime", 0), 12, format),
b" ", # checksum field
info.get("type", REGTYPE),
stn(info.get("linkname", ""), 100, encoding, errors),
info.get("magic", POSIX_MAGIC),
stn(info.get("uname", ""), 32, encoding, errors),
stn(info.get("gname", ""), 32, encoding, errors),
itn(info.get("devmajor", 0), 8, format),
itn(info.get("devminor", 0), 8, format),
stn(info.get("prefix", ""), 155, encoding, errors)
]
buf = struct.pack("%ds" % BLOCKSIZE, b"".join(parts))
chksum = calc_chksums(buf[-BLOCKSIZE:])[0]
buf = buf[:-364] + bytes("%06o\0" % chksum, "ascii") + buf[-357:]
return buf
Hi,
I have similar problem as you had. Every app I build via buildozer
crashed in android, but works like charm om my Xubuntu.
Could you please point me, how did you solve the issue?
Thx Y
Hi, just find tarfile.py
and change _create_header
function as in my previous comment
This doesn't work for me. I even deleted tarfile.cpython-37.pyc in /usr/lib/python3.7/__pycache__ folder. I have similar problem with crushing on start. Everything seems OK...
buildozer android logcat | grep python ... 11-16 14:08:10.958 3329 3329 V pythonutil: Loading library: python3.7m 11-16 14:08:10.962 3329 3329 V pythonutil: Loading library: main 11-16 14:08:10.964 3329 3329 V pythonutil: Failed to load _io.so or unicodedata.so...but that's okay. 11-16 14:08:10.964 3329 3329 V pythonutil: Unsatisfied linker when loading ctypes 11-16 14:08:10.964 3329 3329 V pythonutil: Loaded everything! 11-16 14:08:11.031 3329 3350 I python : Initializing Python for Android 11-16 14:08:11.031 3329 3350 I python : Setting additional env vars from p4a_env_vars.txt 11-16 14:08:11.031 3329 3350 I python : Changing directory to the one provided by ANDROID_ARGUMENT 11-16 14:08:11.031 3329 3350 I python : /data/user/999/org.test.cars/files/app 11-16 14:08:11.031 3329 3350 I python : Preparing to initialize python 11-16 14:08:11.031 3329 3350 I python : _python_bundle dir exists 11-16 14:08:11.031 3329 3350 I python : calculated paths to be... 11-16 14:08:11.031 3329 3350 I python : /data/user/999/org.test.cars/files/app/_python_bundle/stdlib.zip:/data/user/999/org.test.cars/files/app/_python_bundle/modules 11-16 14:08:11.031 3329 3350 I python : set wchar paths...
I have been trying to import openpyxl in my main.py file.When i run buildozer android debug everything seems to be working fine.But when i open the app on my android it crashes.Can you help me with finding the solution.
Why can't i import openpyxl. When i don't use this module in my main file everthing works good but after importing it the app crashes.
please check that you have the same error in your logcat as the one shared in original post before commenting or adding a "me too" there are lots of unrelated possible reason for your app to crash, don't mix these issues in the same post.
I found a workaround: tarfile.py:
@staticmethod def _create_header(info, format, encoding, errors): """Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants. """ parts = [ stn(info.get("name", ""), 100, encoding, errors), itn(info.get("mode", 0) & 0o7777, 8, format), itn(info.get("uid", 0) % 256, 8, format), # <------------------------- itn(info.get("gid", 0) % 256, 8, format), # <------------------------- itn(info.get("size", 0), 12, format), itn(info.get("mtime", 0), 12, format), b" ", # checksum field info.get("type", REGTYPE), stn(info.get("linkname", ""), 100, encoding, errors), info.get("magic", POSIX_MAGIC), stn(info.get("uname", ""), 32, encoding, errors), stn(info.get("gname", ""), 32, encoding, errors), itn(info.get("devmajor", 0), 8, format), itn(info.get("devminor", 0), 8, format), stn(info.get("prefix", ""), 155, encoding, errors) ] buf = struct.pack("%ds" % BLOCKSIZE, b"".join(parts)) chksum = calc_chksums(buf[-BLOCKSIZE:])[0] buf = buf[:-364] + bytes("%06o\0" % chksum, "ascii") + buf[-357:] return buf
@ADR-007, I am just having this "couldn't extract private data" error, and tried to locate the tarfile.py you mentioned. It seems there are quite a few of them in my Ubuntu system. I tried to modify some relevant ones according to your suggestion, but it doesn't seem to help. Perhaps I did not get the right file. Can you specify which file you modified?
where tarfile.py is located
I found a workaround: tarfile.py:
@staticmethod def _create_header(info, format, encoding, errors): """Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants. """ parts = [ stn(info.get("name", ""), 100, encoding, errors), itn(info.get("mode", 0) & 0o7777, 8, format), itn(info.get("uid", 0) % 256, 8, format), # <------------------------- itn(info.get("gid", 0) % 256, 8, format), # <------------------------- itn(info.get("size", 0), 12, format), itn(info.get("mtime", 0), 12, format), b" ", # checksum field info.get("type", REGTYPE), stn(info.get("linkname", ""), 100, encoding, errors), info.get("magic", POSIX_MAGIC), stn(info.get("uname", ""), 32, encoding, errors), stn(info.get("gname", ""), 32, encoding, errors), itn(info.get("devmajor", 0), 8, format), itn(info.get("devminor", 0), 8, format), stn(info.get("prefix", ""), 155, encoding, errors) ] buf = struct.pack("%ds" % BLOCKSIZE, b"".join(parts)) chksum = calc_chksums(buf[-BLOCKSIZE:])[0] buf = buf[:-364] + bytes("%06o\0" % chksum, "ascii") + buf[-357:] return buf
@ADR-007, I am just having this "couldn't extract private data" error, and tried to locate the tarfile.py you mentioned. It seems there are quite a few of them in my Ubuntu system. I tried to modify some relevant ones according to your suggestion, but it doesn't seem to help. Perhaps I did not get the right file. Can you specify which file you modified?
Hm... I found it during debugging... try to run python3 -c 'import tarfile; print(tarfile.__file__)'
and patch this file
(sorry I missed the question)
I tried to change the tarfile and it still crashes, my issue is a bit different as the app crashes in a particular screen, (not on PC, only Android), the error message seems very similar which is why I am also commenting here (there aren't any errors in my code, it works perfectly on PC).
01-29 20:57:19.195 17418 17756 F libc : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 17756 (SDLThread), pid 17418 (org.test.myapp)
01-29 20:57:19.347 17990 17990 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-29 20:57:19.347 17990 17990 F DEBUG : Build fingerprint: 'HUAWEI/PAR-AL00/HWPAR:9/HUAWEIPAR-AL00/9.1.0.405C675:user/release-keys'
01-29 20:57:19.347 17990 17990 F DEBUG : Revision: '0'
01-29 20:57:19.347 17990 17990 F DEBUG : ABI: 'arm'
01-29 20:57:19.347 17990 17990 F DEBUG : Happend: 'Fri Jan 29 20:57:19 2021
01-29 20:57:19.347 17990 17990 F DEBUG : '
01-29 20:57:19.347 17990 17990 F DEBUG : SYSVMTYPE: Art
01-29 20:57:19.347 17990 17990 F DEBUG : APPVMTYPE: Art
01-29 20:57:19.347 17990 17990 F DEBUG : pid: 17418, tid: 17756, name: SDLThread >>> org.test.myapp <<<
01-29 20:57:19.348 17990 17990 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-29 20:57:19.348 17990 17990 F DEBUG : Abort message: 'terminating'
01-29 20:57:19.348 17990 17990 F DEBUG : r0 00000000 r1 0000455c r2 00000006 r3 00000008
01-29 20:57:19.348 17990 17990 F DEBUG : r4 0000440a r5 0000455c r6 c18c3044 r7 0000010c
01-29 20:57:19.348 17990 17990 F DEBUG : r8 e3f4daf1 r9 e4d365f8 r10 e8915acc r11 000000e7
01-29 20:57:19.348 17990 17990 F DEBUG : ip 00000041 sp c18c3030 lr e4cada6d pc e4ca5796
01-29 20:57:19.353 17990 17990 F DEBUG :
01-29 20:57:19.353 17990 17990 F DEBUG : backtrace:
01-29 20:57:19.353 17990 17990 F DEBUG : #00 pc 0001d796 /system/lib/libc.so (abort+58)
01-29 20:57:19.353 17990 17990 F DEBUG : #01 pc 00032b41 /system/lib/libc++.so (abort_message+88)
01-29 20:57:19.353 17990 17990 F DEBUG : #02 pc 00032c31 /system/lib/libc++.so (demangling_terminate_handler()+20)
01-29 20:57:19.353 17990 17990 F DEBUG : #03 pc 00041883 /system/lib/libc++.so (std::__terminate(void (*)())+2)
01-29 20:57:19.353 17990 17990 F DEBUG : #04 pc 0004190b /system/lib/libc++.so (std::terminate()+78)
01-29 20:57:19.353 17990 17990 F DEBUG : #05 pc 0007fee3 /system/lib/libc++.so (std::__1::thread::~thread()+10)
01-29 20:57:19.353 17990 17990 F DEBUG : #06 pc 00067df3 /system/lib/libc.so (__cxa_finalize+134)
01-29 20:57:19.353 17990 17990 F DEBUG : #07 pc 000183eb /system/lib/libc.so (exit+10)
01-29 20:57:19.353 17990 17990 F DEBUG : #08 pc 0018f384 /data/app/org.test.myapp-xD8SvMrGc6ESGT2YYacAkg==/lib/arm/libpython3.8m.so (Py_Exit+28)
Hi, i had a bug like this, with SIGABRT and the end line about "/lib/arm/libpython3.8m.so (Py_Exit+28)"
My app was running good on my PC , but not in my android (crashing on loading).
I don't know why your app crashes but I solved my problem with adb:
After connection on my phone with a usb cable, and establishing a connection with my phone I do this:
adb logcat | grep python
When i launched my app, it allowed me to get lines of my main.py file which was erroring.
Good Luck
SIGABRT occurs if theirs is a CPU intensive operation happening while the app is still launching or thread operation going on check the imported modules for methods that might cause a low memory faults, on_start of the app.
Versions
Description
Could not extract private data
and dieI fixed
tarfile.py
: I changeditn(info.get("uid", 0), 8, format),
toitn(info.get("uid", 0), 12, format),
. It was the only way to make it work.I spent a lot of time to figure out how to fix it, found a lot similar problem, but there was not any solution.
buildozer.spec
Command:
Spec file: (default file content)
Logs
Source code