-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Recently I found myself in need to use SIP for wrapping some custom C++ Qt library and using it in python. Then I found this repository which looked very promising for my particular project. I have immediately tested code provided in this repo on Manjaro, with Python 3.6 and (Py)Qt 5.9 - no problems. Everything went smooth. But that was only for testing, because I need it to work on Windows 10. And here the problems begun...
My setup:
- Windows 10
- Python 3.6.1
- Qt 5.9.1
- PyQt 5.9.1 (installed from binary)
- SIP 4.19.7
- Microsoft Visual Studio Community 2017
Problems with step one: python configure.py
Since the newest versions of python like to install themselves in C:\Program Files (x86) almost or all the paths that are added to cmd in configure.py must be in quotes in order to work. The only exception was config.sip_bin which for whatever reason did throw error even in quotes, but since I had sip on my system path I have just omitted the full path and used sip.
Then of course the known problem with sip: Unable to find file "QtGui/QtGuimod.sip". I have managed to solve it with help of #1 so I will not elaborate on that.
Finally, since there is no more MSVC 2010 available, we have to use VS2017 Community. Which means that the line qmake_cmd += " -spec win32-msvc2010" throws an error. Substituting win32-msvc2010 with win32-msvc, winrt-x86-msvc2015 or winrt-x86-msvc2017 enabled me to move further (it did not throw an error) but I am still not sure whether it is correct and which should I use.
Eventually the python configure.py did worked and it generated the makefile.
Problems with step two: make
I am not used to compiling stuff on windows, but as it appears windows uses nmake instead of make. I do not know how it was with MSVC 2010, but using nmake with VS 2017 turns out to be a bit tricky. First I had to run cmd /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" to enter the VS 2017 Developer Command Prompt and then I had to source the environment variables with "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat". As stated on Microsoft Forum "it is not a bug, it's a feature" and it is the only way to use nmake. Eventually the nmake command worked. But it throws an error:
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd src
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile.Release
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd D:\Scripts\PyMyLabel-master\modules
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DLL /MANIFEST /MANIFESTFILE:PyMyLabel.pyd.manifest /SUBSYSTEM:WINDOWS /INCREMENTAL:NO /OUT:PyMyLabel.pyd @C:\Users\Devlig~1\AppData\Local\Temp\nm569E.tmp
LINK : fatal error LNK1181: cannot open input file 'Qt5Core.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x49d'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
And here I am stuck with no idea how to proceed. I suppose that the configure.py is still not working properly and generates buggy makefiles. I have tried adding some additional paths to sip that will point to where Qt dlls are but with no luck. Here is how my sip cmd looks like this:
sip -t WS_WIN -t Qt_5_9_2 -I "D:\Scripts\PyMyLabel-master\sip" -I "C:\Program Files (x86)\Python36-32\sip" -I "E:\Qt\5.9.1\mingw53_32\include" -I "E:\Qt\5.9.1\mingw53_32\lib" -I "C:\Program Files (x86)\Python36-32\include" -I "D:\Scripts\PyMyLabel-master\src" -c "D:\Scripts\PyMyLabel-master\modules" -b "D:\Scripts\PyMyLabel-master\modules\PyMyLabel.sbf" -w -o "D:\Scripts\PyMyLabel-master\sip\PyMyLabel.sip"
-I "E:\Qt\5.9.1\mingw53_32\include" -I "E:\Qt\5.9.1\mingw53_32\lib" are the paths I have added but they change nothing.
I am not experienced with this so I might be missing something obvious. It would be so great if you @jazzycamel could update this minimal SIP example repository for newer versions of Windows, Python, (Py)Qt, SIP and VS. As I mentioned at the beginning, on Linux it worked for me out of the box. Or please direct me on the right path on how to proceed. Thank you.