openpreserve / jpylyzer

JP2 (JPEG 2000 Part 1) validator and properties extractor. Jpylyzer was specifically created to check that a JP2 file really conforms to the format's specifications. Additionally jpylyzer is able to extract technical characteristics.
http://jpylyzer.openpreservation.org/
Other
69 stars 28 forks source link

[Improvement] Windows packaging on Linux using Wine #87

Closed bitsgalore closed 7 years ago

bitsgalore commented 8 years ago

According to the PyInstaller FAQ it is possible to cross-compile Windows binaries under Linux using Wine. See:

https://github.com/pyinstaller/pyinstaller/wiki/FAQ

And more specifically:

https://groups.google.com/forum/#!topic/pyinstaller/veq3BlA_Bns

This might be worth investigating, as it could potentially make the Windows binary creation more straightforward (e.g. create dedicated Vagrant boxes with the required environment, including Wine).

bitsgalore commented 7 years ago

How to set up the environment:

TODO:

Perhaps use portable installations?

This works:

http://winpython.github.io/

Installation works both with 64- and 32 bit versions (though I weeded out some of the other stuff that is installed by WinPython). Pip.exe also fails, but as a workaround we can use this:

wine   ~/.wine/drive_c/Python27_32/python.exe -m pip install pyinstaller

Perhaps installation could be automated with a script.

Meanwhile this largely works (but version number extraction fails for some reason!):

https://github.com/openpreserve/jpylyzer/tree/fixwinebuild

bitsgalore commented 7 years ago

The following script does most of what is needed: https://github.com/openpreserve/jpylyzer/blob/fixwinebuild/buildwin.sh

However in some cases the Zip file names contain garbage, e.g.:

jpylyzer_fixme:msvcrt:MSVCRT__wsopen_s.zip

This needs a fix. This might work:

https://stackoverflow.com/questions/33907144/error-when-running-python-in-wine-fixmemsvcrt-clean-type-info-names-internal

and also:

https://askubuntu.com/questions/9284/how-to-make-wine-be-quiet-about-msvcr-errors

Finally according to below post import errors can occur for imported modules, which is remedied by adding the site-packages dir to pathex:

http://sparkandshine.net/en/build-a-windows-executable-from-python-scripts-on-linux/

ALSO the output of the build script includes this error:

err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.

Solution: install winbind package (see also here):

sudo apt-get install winbind
bitsgalore commented 7 years ago

Wine garbage now suppressed in:

https://github.com/openpreserve/jpylyzer/commit/82273c360d87f12e7ce334c2197a4049b98fe3f2