Skip to content
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

Fail to found python dll since Python 3.12 (UPX issue) #62

Open
Faduf opened this issue Sep 12, 2024 · 5 comments
Open

Fail to found python dll since Python 3.12 (UPX issue) #62

Faduf opened this issue Sep 12, 2024 · 5 comments
Assignees

Comments

@Faduf
Copy link

Faduf commented Sep 12, 2024

We are using the official pywine docker from dockerhub to generate .exe binaries with PyInstaller inside the docker. At the end of our script we have a check by using wine generated_binary.exe -v to get the binary version. Since the update to Python 3.12, this command returns the following error :

[PYI-228:ERROR] Failed to load Python DLL 'C:\users\root\AppData\Local\Temp\_MEI2202\python312.dll'.
LoadLibrary: DLL initialization failed.

This can be reproduced with pywine:3.12 and pywine:latest (currently python 3.12.4).

@TobiX TobiX self-assigned this Sep 14, 2024
@TobiX
Copy link
Member

TobiX commented Sep 14, 2024

Hmm. I cannot reproduce this issue. Any non-standard mounts maybe? On which filesystem(s) is/are your docker storage directories? We already had horrible issues on WSL2 mounts (#16 (comment)), but you should receive a big, fat warning with such a setup (at least when launching the container through the default entrypoint...)

@Faduf
Copy link
Author

Faduf commented Sep 17, 2024

We have this on different Linux Debian 11 machines. The following docker run command is used :

docker run --rm --workdir=/tools -v $CI_PROJECT_DIR/tools:/tools --user $(id -u):$(id -g) tobix/pywine bash -xe $CI_JOB_NAME.sh

the script $CI_JOB_NAME.sh is used to install required python libraries, generate the .exe with PyInstaller and check the .exe sanity :

      . /opt/mkuserwineprefix
      export PYTHONDONTWRITEBYTECODE=1

      wine pip3 install -r /$PYREQ_PATH

      wine pyinstaller swupdate-client.py \
        --collect-submodules websockets \
        --workpath /tmp -F -y --clean

      wine pyinstaller swupdate-archiver/swupdate_archiver.py \
        --add-binary "/$CPIO_PATH/bin/*;." \
        --workpath /tmp -F -y --clean

      { echo "swupdate_archiver: \$(wine dist/swupdate_archiver.exe -v)"
        echo "swupdate-client: \$(wine dist/swupdate-client.exe -v)"
      }>versions.manifest

@TobiX
Copy link
Member

TobiX commented Sep 17, 2024

Could you try with --noupx or just --upx-exclude python312.dll? Not sure what's the issue is with UPX, but it seems to conflict with Python 3.12 under wine...

(I'd suggest to disable UPX if you don't care that much about the final file size, since it often leads to false-positives with Anti-Virus software)

@Faduf
Copy link
Author

Faduf commented Sep 18, 2024

Both solutions (--noupx or --upx-exclude python312.dll) solve the issue. The final file size increases a bit but it is acceptable.

@TobiX
Copy link
Member

TobiX commented Sep 18, 2024

This seems similar to pyinstaller/pyinstaller#1565 ... Strange that it only affects Wine...

@TobiX TobiX changed the title Fail to found python dll since Python 3.12 Fail to found python dll since Python 3.12 (UPX issue) Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants