MINGW-packages icon indicating copy to clipboard operation
MINGW-packages copied to clipboard

[python-nuitka] nuitka build of "wxhello.py" file fails when using msys2 "C:\msys64" on Windows 10

Open noeldiviney opened this issue 1 year ago • 5 comments

Description / Steps to reproduce the issue

Steps to demonstrate problem

1 Extract the attached "msys64setuo.zip" into "C:\nuitka\msys64setup" We now have "c:\nuitka\msts64setup\msys64setup.sh" which is a Bash script to demonstrate the Nuitka problem
2 Download the MSYS2 installer by going to "https://www.msys2.org" Scroll down to "Installation" and click on the "msys2-x86_64-20240727.exe" installer link. Save installer to "C:\nuitka" 3 Install msys64 by double clicking "C:\nuitka\msys2-x86_64-20240727.exe" Install to "c:/nuitka/msys64" Click the "Finish" button to launch the msys64 terminal 4 Initialise msys64 by executing the following bash commands :-. $ cd /c/nuitka/msys64setup/ $ ./msys64setup.sh A restart of C:\nuitka\msys64\ucrt64.exe is required when the following output is displayed :-. "To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n]" To continue go to Step 5. 5. Restart msys64 terminal by executing "C:\nuitka\msys64\ucrt64.exe" and then entering the following bash commands. $ cd /c/nuitka/msys64setup/ $ ./msys64setup.sh "msys64setup.sh" will now perform the following :-. A, Setup a MSYS2 working environment with toolchain, msys2-devel, mingw-w64-ucrt-x86_64-python3, mingw-w64-ucrt-x86_64-python-pip, mingw-w64-ucrt-x86_64-wxPython, mingw-w64-ucrt-x86_64-python-nuitka. B. Create a wxPython "Hello World" minimal GUI source program "wxhello.py". C. Use the installed "C:\nuitka\msys64\ucrt64\bin\nuitka3.exe" to build "wxhello.py" as follows :-. "nuitka3 --standalone wxhello.py --python-flag=-O" command. D. Execute the successfully built wxhello.exe with command "./wxhello.dist/wxhello.exe" wxhello.exe fails with "ImportError: LoadLibraryExW 'C:\nuitka\MSYS64~1\WXHELL~1.DIS\wx_core.pyd' failed: The specified module could not be found. Now note the use of a single "" in 'C:\nuitka\MSYS64~1\WXHELL~1.DIS\wx_core.pyd' The following commands will correctly display that folder "wx" contents do exist :- "ls -al C:\nuitka\MSYS64~1\WXHELL~1.DIS\wx" and "ls -al C:/nuitka/MSYS64~1/WXHELL~1.DIS/wx"

  1. Attached files msys64setup.zip msys64setup-log.txt

Expected behavior

The wxPython wxhello.exe should display the GUI sucessfully

Actual behavior

wxhello.exe fails with the following error:- Line 179 msys2.bash Executing ./wxhello.dist/wxhello.exe Traceback (most recent call last): File "C:\nuitka\MSYS64~1\WXHELL~1.DIS\wxhello.py", line 7, in File "C:\nuitka\MSYS64~1\WXHELL~1.DIS\wx/init.py", line 17, in File "C:\nuitka\MSYS64~1\WXHELL~1.DIS\wx/core.py", line 12, in ImportError: LoadLibraryExW 'C:\nuitka\MSYS64~1\WXHELL~1.DIS\wx_core.pyd' failed: The specified module could not be found.

Verification

  • [X] I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)

Windows Version

MINGW64_NT-10.0-19045

MINGW environments affected

  • [ ] MINGW64
  • [ ] MINGW32
  • [X] UCRT64
  • [ ] CLANG64
  • [ ] CLANG32
  • [ ] CLANGARM64

Are you willing to submit a PR?

I would like to

noeldiviney avatar Sep 26 '24 03:09 noeldiviney

@podsvirov Would you like to look into this issue, please?

Biswa96 avatar Sep 26 '24 04:09 Biswa96

@noeldiviney, I experience similar problems when exporting PySide projects too... But this is, in many ways, the problem of nuitka itself, and not the msys2 distribution. Support for the msys2 distribution is getting better release by release. Feel free to submit your bug reports or pull requests in the Nuitka repository.

podsvirov avatar Sep 26 '24 19:09 podsvirov

Thanks guys for your responses. I had actually raised Issue #3112 on the nuitka issue tracker 3 weeks ago but no response as yet! As the nuitka installed from the prebuilt binaries is at version 2.1.6 I have updated nuitka to version 2.4.8 (The latesr). The wxhello.exe still fails with same "error". I have updated nuitka error #3112 to reflect this and I now await a response.

I notice that Nuitka makes no mention of supporting MSYS64 so perhaps it would help if you indicate you have a similar issue.

The Install command in the 'build from source' documentation needs to be updated from pacman -U ${package-name}*.pkg.tar.xz to pacman -U ${package-name}*.pkg.tar.zst

The binary that is built is named 'mingw-w64-x86_64-python-nuitka-2.4.8-2-any.pkg.tar.zst' Note the 'tar' ending is now '.zst'

Any plans to bring the default nuitka binary to version 2.4.8?

Thank you for creating MSYS2. Noel Diviney

noeldiviney avatar Sep 27 '24 07:09 noeldiviney

Hi @Biswa96 @podsvirov Great news from Nuitka @kayheyen The problem is now fixed in the factory branch. So we hould have a new version release shortly. This makes very happy as I find msys64 on Windows 10 gives me a nice Embedded Systems Development Eivironment for my projects. Best regards Noel Diviney.

noeldiviney avatar Oct 03 '24 08:10 noeldiviney

As an alternative, I suggest trying the pyinstaller package with similar functionality that we recently added.

podsvirov avatar Oct 12 '24 15:10 podsvirov