renpy / renpy-build

Build system for the Ren'Py visual novel engine. (The engine itself, not games.)
76 stars 51 forks source link

Broken libraries #109

Closed qTich closed 10 months ago

qTich commented 11 months ago

adb8b029db5a4623fb355e53e8cc3b2f9222e4ac - breaks launching on android, i guess it affects all 3 libraries - pyjnius, pyobjus, steam

2023-12-13 06:01:20.698  2630-2780  python                  com.package              I  Traceback (most recent call last):
2023-12-13 06:01:20.698  2630-2780  python                  com.package              I    File "/data/user/0/com.package/files/main.py", line 260, in <module>
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I      main()
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I    File "/data/user/0/com.package/files/main.py", line 256, in main
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I      renpy.bootstrap.bootstrap(renpy_base)
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I    File "renpy/bootstrap.py", line 321, in bootstrap
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I    File "renpy/__init__.py", line 406, in import_all
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I    File "renpy/loader.py", line 75, in <module>
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I    File "lib/python3.9/android/__init__.py", line 1, in <module>
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I    File "lib/python3.9/__init__.py", line 12, in <module>
2023-12-13 06:01:20.699  2630-2780  python                  com.package              I  ImportError: bad magic number in 'jnius.env': b'\xa7\r\r\n'
mal commented 11 months ago

The magic number from renpy-8.2.0.23121103+nightly-sdk-ci/lib/python3.9/jnius/env.pyc is 61 0d 0d 0a. The magic number from the python3.9 binary that ships with the same Ren'Py SDK matches:

>>> print(*('{:02x}'.format(x) for x in importlib.util.MAGIC_NUMBER))
61 0d 0d 0a

The a7 0d 0d 0a magic number (aka b'\xa7\r\r\n' from OP) is the magic number of py3.11.

Given the above, it seems unlikely that this behaviour was observed by building from a nightly SDK (if I'm incorrect in this, please provide the exact version). If resulting from your own builds, is it possible that you built the web version prior to building the android version?

qTich commented 11 months ago

The magic number from renpy-8.2.0.23121103+nightly-sdk-ci/lib/python3.9/jnius/env.pyc is 61 0d 0d 0a. The magic number from the python3.9 binary that ships with the same Ren'Py SDK matches:

>>> print(*('{:02x}'.format(x) for x in importlib.util.MAGIC_NUMBER))
61 0d 0d 0a

The a7 0d 0d 0a magic number (aka b'\xa7\r\r\n' from OP) is the magic number of py3.11.

Given the above, it seems unlikely that this behaviour was observed by building from a nightly SDK (if I'm incorrect in this, please provide the exact version). If resulting from your own builds, is it possible that you built the web version prior to building the android version?

I think it's enough to build The Question on one of the last two nightly builds to see the problem.

qTich commented 10 months ago

Broken .pyc:

'/lib/python3.9/steamapi.pyc': b'\xa7\r\r\n',
'/lib/python3.9/jnius/signatures.pyc': b'\xa7\r\r\n',
'/lib/python3.9/jnius/reflect.pyc': b'\xa7\r\r\n'
mal commented 10 months ago

Bytecode generated for the web version was leaking (pseudo-randomly due to glob order), a more targeted filter should ensure we always get the correct files.