Issue251

Title Problems running under wine
Priority bug Status resolved
Superseder Nosy List kayhayen, univerz
Assigned To univerz Keywords

Created on 2015-10-08.09:03:33 by univerz, last changed by kayhayen.

Files
File name Uploaded Type Edit Remove
nuitkaMpImportingTest.py univerz, 2015-10-08.09:03:33 text/x-java
nuitkaWineQtDllTest.py univerz, 2015-10-25.18:20:49 text/x-java
Messages
msg2202 (view) Author: kayhayen Date: 2017-07-19.17:54:57
No feedback, no decision.
msg1955 (view) Author: kayhayen Date: 2016-08-17.19:12:27
Any news on this, did you suceed with the proposed 

if win_target:
    # Windows XP
    env.Append(
        CPPDEFINES = ["_WIN32_WINNT=0x0501"]
    )

change?

Yours,
Kay
msg1664 (view) Author: kayhayen Date: 2015-10-26.06:46:43
This code is in SingleExe.scons

# The 32 bits MinGW does not default for API level properly, so help it.
if mingw_mode:
    # Windows XP
    env.Append(
        CPPDEFINES = ["_WIN32_WINNT=0x0501"]
    )

The mingw_mode won't kick in for you, and most likely the condition could be 
"win_target", as it likely won't harm MSVC either. For you, I suggest to change to:

if win_target:
    # Windows XP
    env.Append(
        CPPDEFINES = ["_WIN32_WINNT=0x0501"]
    )

Then you might be good, and I have kind of a patch to try out, which will help with 
wine here.

Yours,
Kay
msg1663 (view) Author: kayhayen Date: 2015-10-26.06:42:32
This seems to suggest that it takes another definition:

http://stackoverflow.com/questions/12049335/setdlldirectory-not-declared-in-
this-scope-netbeans-7-1

I forgot, but somehow I did this for 0.5.13 in some way already, I think:

- MinGW: Modules can now be created again. The run time relative code uses an
  API that is WinXP only, and MinGW failed to find it without guidance.

Maybe not done under wine, I don't know yet, what the exact diff is that is 
attached to this.

Yours,
Kay
msg1662 (view) Author: univerz Date: 2015-10-25.20:05:48
On 2015-10-25 19:41, Kay Hayen (via Issue Tracker) wrote:
> So either MinGW does it on its own (or doesn't work with standalone, 
> but
> I think it does), or it's necessary and not done, and you come across
> that now.
> 
> It's in CompiledCodeHelpers.cpp, and I suspect, that if you change that 
> to
> 
> #if defined( _WIN32 )
> SetDllDirectory( binary_directory );
> #endif
> 
> you ought to be good.

Nuitka-develop\nuitka\build\static_src\CompiledCodeHelpers.cpp:2592:39: 
error: 'SetDllDirectory' was not declared in this scope

after googling i tried #include <windows.h>, but with no success. i'll 
investigate it later, windows is unknown territory for me :)
msg1661 (view) Author: kayhayen Date: 2015-10-25.18:41:56
So this code must be at fault:

#if defined( _WIN32 ) && defined( _MSC_VER )
    SetDllDirectory( binary_directory );
#endif

So either MinGW does it on its own (or doesn't work with standalone, but
I think it does), or it's necessary and not done, and you come across
that now.

It's in CompiledCodeHelpers.cpp, and I suspect, that if you change that to

#if defined( _WIN32 )
    SetDllDirectory( binary_directory );
#endif

you ought to be good.

The reason it works is because if you move it to the DLL directory, that
one is there by default, just the binary directory needs help. And the non
Qt DLLs are taken from system and just work.

My next Windows boot (might be days though :) I will investigate this for
MinGW. There must have been some issue with SetDllDirectory not easily
available with gcc. 

Yours,
Kay
msg1659 (view) Author: univerz Date: 2015-10-25.18:20:49
On 2015-10-25 12:27, Kay Hayen (via Issue Tracker) wrote:
> Can you be a bit more specific, which DLLs need to be moved from where
> to where,
> and does that then still run under Windows?

more info, problem only occurs when running program from another 
directory

univerz@localhost ~/.wine/drive_c $ wine 
./nuitkaWineQtDllTest.dist/nuitkaWineQtDllTest.exe
err:module:import_dll Library QtGui4.dll (which is needed by 
L"C:\\nuitkaWineQtDllTest.dist\\PyQt4\\QtGui.pyd") not found
err:module:import_dll Library QtCore4.dll (which is needed by 
L"C:\\nuitkaWineQtDllTest.dist\\PyQt4\\QtGui.pyd") not found
Traceback (most recent call last):
File "C:\nuitkaWineQtDllTest.dist\nuitkaWineQtDllTest.py", line 2, in 
<module>
from PyQt4 import QtGui
ImportError: LoadLibraryEx 'C:\nuitkaWineQtDllTest.dist\PyQt4\QtGui.pyd' 
failed
fixme:msvcrt:__clean_type_info_names_internal (0x1e24e5d8) stub

otherwise it's ok

univerz@localhost ~/.wine/drive_c $ cd ./nuitkaWineQtDllTest.dist
univerz@localhost ~/.wine/drive_c/nuitkaWineQtDllTest.dist $ wine 
./nuitkaWineQtDllTest.exe

anyway, when nuitkaWineQtDllTest.dist/qt*4.dll are moved to 
nuitkaWineQtDllTest.dist/PyQt4/ it works in both cases and under windows 
too (win7).
msg1654 (view) Author: kayhayen Date: 2015-10-25.11:27:11
So casing does not matter. And it works under Windows, great news.

Can you be a bit more specific, which DLLs need to be moved from where to where, 
and does that then still run under Windows?

Yours,
Kay
msg1653 (view) Author: univerz Date: 2015-10-25.03:33:19
it looks like problem is in wine. *.dist generated under wine works well 
under windows.

under wine, dlls are loaded only if they are moved to .dist/PyQt4/, 
cammelcase is not an issue after all.
msg1631 (view) Author: kayhayen Date: 2015-10-12.06:46:08
Ok, waiting for your vacation end then, I am pushing the scons issue to factory.
msg1622 (view) Author: univerz Date: 2015-10-10.10:18:01
> The file name issue for Qt could be worked around by Nuitka. But can 
> you report
> that to PyQt upstream. Relying on case insensitive file systems would
> be a bug of
> theirs, and they can name their files correctly. But I wonder, why
> under wine, it would work then in the first place?

files under site-packages/PyQt4 are named correctly, i will investigate 
it further after vacation.

> The "24" in your filename looks like an error, or doesn't imply Python
> 2.4 right, since not even 2.5 would be supported.

yes, typing error.

> I wonder, if "wine" works these days on Debian. I might have to give
> it a try myself or debootstrap something. What are you on?

gentoo, wine-1.7.38
works fine for simple applications, but my PyQt beast with 
multiprocessing, threads and lots of libraries is out of reach. but at 
least i can easily generate builds with pyinstaller and, as i see speed 
of development, with nuitka in a short time :).
msg1621 (view) Author: kayhayen Date: 2015-10-10.09:13:41
The use of /usr/bin/scons should be guarded with OS check, I am adding that.

The file name issue for Qt could be worked around by Nuitka. But can you report 
that to PyQt upstream. Relying on case insensitive file systems would be a bug of 
theirs, and they can name their files correctly. But I wonder, why under wine, it 
would work then in the first place?

The ".pyc" file winning against the compiled version ought to not be that much of a 
problem, as it only changes the module loader. The ".pyc" loader may be before the 
Nuitka. This could be a valuable hint.

The "24" in your filename looks like an error, or doesn't imply Python 2.4 right, 
since not even 2.5 would be supported.

Thanks for taking the time to identify these "wine" issues. They might not be 
visible otherwise, but as usual, different platforms find different issues. I 
wonder, if "wine" works these days on Debian. I might have to give it a try myself 
or debootstrap something. What are you on?

Yours,
Kay
msg1619 (view) Author: univerz Date: 2015-10-09.15:13:03
hi,

i tested it under windows, there is the same problem.

initial loading of module is successfull, as it prints 'starting 
processes'. error is related to the Issue219, where you predicted 
problem with sys.frozen & import mechanism of nuitka. i mistakenly 
created new issue instead of message there. please delete this one.

however, there are some minor issues under wine:

* it uses host system /usr/bin/scons; so i disabled that option in 
nuitka/build/SconsInterface.py

* PyQt4/*.pyd files expects dll files located in PyQt4 directory with 
camelcase naming (QtCore4.dll), but they are located directly in .dist 
with lowercase name; not related to nuitka directly and easily solved

* "monkey patching" of multiprocessing triggers only if there are no 
*.pyc files in Python24/Lib/multiprocessing; this took me a while and a 
few reinstals to realize :)
msg1618 (view) Author: kayhayen Date: 2015-10-08.15:59:08
Ah, this could also about how the binary re-executes itself, that may be different 
to wine.
msg1617 (view) Author: kayhayen Date: 2015-10-08.15:58:02
Hm, this looks as if the plugin didn't kick in at all, maybe that is because of wine, I 
need to check. Do you messages related to the plugin from the compilation itself, i.e. in 
the "..." part?

Yours,
Kay
msg1615 (view) Author: univerz Date: 2015-10-08.09:03:33
hi,

i ran into predicted problem with importing mechanism of Nuitka. 
stripped code is attached.

there is some _Popen magic and weird target left to ensure that solution 
will work for me, but result is the same without using it.

univerz@localhost ~/.wine/drive_c $ wine Python27/python.exe 
c:/Nuitka-develop/bin/nuitka --standalone --show-progress --recurse-all 
--recurse-to=multiprocessing --plugin-enable=multiprocessing 
c:/nuitkaMpImportingTest.py
...
univerz@localhost ~/.wine/drive_c $ wine 
nuitkaMpImportingTest.dist/nuitkaMpImportingTest.exe
starting processes
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
prepare(preparation_data)
File "C:\Python27\lib\multiprocessing\forking.py", line 489, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named nuitkaMpImportingTest
History
Date User Action Args
2017-07-24 06:56:05kayhayensetstatus: chatting -> resolved
2017-07-19 17:54:57kayhayensetassignedto: kayhayen -> univerz
messages: + msg2202
2016-08-17 19:12:27kayhayensetmessages: + msg1955
2015-10-26 06:46:43kayhayensetmessages: + msg1664
2015-10-26 06:42:32kayhayensetmessages: + msg1663
2015-10-25 20:05:48univerzsetmessages: + msg1662
2015-10-25 18:41:56kayhayensetmessages: + msg1661
2015-10-25 18:20:49univerzsetfiles: + nuitkaWineQtDllTest.py
messages: + msg1659
2015-10-25 11:27:11kayhayensetmessages: + msg1654
2015-10-25 03:33:19univerzsetmessages: + msg1653
2015-10-12 06:46:08kayhayensetmessages: + msg1631
2015-10-10 10:18:01univerzsetmessages: + msg1622
2015-10-10 09:13:41kayhayensetstatus: resolved -> chatting
messages: + msg1621
2015-10-10 09:04:55kayhayensetstatus: chatting -> resolved
priority: wish -> bug
assignedto: kayhayen
nosy: + kayhayen
title: issue219 _err, mistake, pls remove_ -> Problems running under wine
2015-10-09 15:13:03univerzsetmessages: + msg1619
2015-10-08 15:59:08kayhayensetmessages: + msg1618
2015-10-08 15:58:02kayhayensetstatus: unread -> chatting
messages: + msg1617
2015-10-08 09:23:54univerzsettitle: issue219 -> issue219 _err, mistake, pls remove_
2015-10-08 09:23:06univerzsetpriority: wish
2015-10-08 09:03:33univerzcreate