[PyQt] How do you compile 64bit PyQt on Windows w/o Visual Studio.
Brian Knudson
briank at pipelinefx.com
Sat May 19 01:53:25 BST 2012
On May 18, 2012, at 2:17 AM, Phil Thompson wrote:
> On Thu, 17 May 2012 17:46:21 -0700, Brian Knudson <briank at pipelinefx.com>
> wrote:
>> I'm trying to compile 64bit PyQt on Windows 7. (I am a commercial
>> customer, so I have to build PyQt, AFAIK). I've downloaded MinGW & had
>> good success getting SIP compiled, but I couldn't compile PyQt. I
> deduce
>> that this is because I have 64bit Python with a 32bit MinGW & the libs
>> aren't matching. Fair enough, now I've downloaded & installed (read:
>> unpacked) MinGW64, but I have 2 big questions:
>>
>> 1. Short of editing all the makfiles to use "x86_64-w64-mingw32-g++.exe"
>> rather than "g++" for the compiler, is there a way to tell the configure
>> step to use the 64bit MinGW? I see that the standard build toolchain
> often
>> takes --host, but that doesn't seem to be the case for sip or pyqt.
> There
>> also doesn't seem to be a platform options for mingw64.
>
> PyQt's configure.py uses the information in your Qt installation's qmake
> mkspec files. So things should work if your Qt supports building with
> MinGW64.
Good point. The only binary release of the Qt libs for MinGW appear to be for the 32 bit version. I see references on the web that there once were Qt libs for MinGW64, but they don't appear to be around any more. I tried compiling QT from source using mingw-w64, but configure doesn't seem to like 'win32-g++' as an argument to platform & I don't see a way to list available platforms. Looking through the configure shell script shows 'win32-g++' should be a valid option. I think I'm giving up on this option.
>> 2. (Possibly more important). When I compiled the 32bit version of sip
>> with MinGW, I needed to make a libpython26.a from python26.dll. I say
>> "needed" as the python libs weren't found during compile (causing it to
>> fail) and my research lead me to this necessity. After putting
>> libpython26.a in place, the build completed successfully (I actually
> found
>> a libpython26.a available for download as my attempts to build one
> failed
>> due to word-size mismatch). The pexporter I've attempted to recompile
>> pexporter using mingw64's g++, but it segfaults when I try to run it on
> the
>> 64bit python26.dll. With that:
>> 2.a. Is it necessary to create a libpython26.a to compile with mingw's
>> g++ on Windows? If not, what's the other way of doing it? If so, are
>> there any good instructions for making it?
>> 2.b. How does one do this for 64bit python26.dll?
>
> From memory (so I may be wrong) it's no longer necessary to do this and
> hasn't been for some time (if you have a recent enough version of MinGW).
In the interest in putting out what I hope to be accurate information, I downloaded mingw just a few days ago. It (compiling sip) does not work unless libpython26.a is in c:\python26\libs. I just tested this again...
with libpython26.a:
configure --platform=win32-g++
make
--success!--
without libpython26.a:
configure --platform=win32-g++
make
....
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -sh
ared -Wl,-subsystem,console -Wl,-s -o sip.pyd siplib.o apiversions.o descriptors.o qtlib.o threads.o
objmap.o voidptr.o bool.o -LC:\Python26\libs -lpython26
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: C:\Python26\libs/python26.lib(
python26.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: C:\Python26\libs/python26.lib(
python26.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
siplib.o:siplib.c:(.text+0x46): undefined reference to `_imp___Py_NoneStruct'
siplib.o:siplib.c:(.text+0x4bc): undefined reference to `_imp__PyType_Type'
siplib.o:siplib.c:(.text+0x580): undefined reference to `_imp__PyType_Type'
siplib.o:siplib.c:(.text+0x5bf): undefined reference to `_imp___Py_NoneStruct'
siplib.o:siplib.c:(.text+0x60a): undefined reference to `_imp__PyExc_TypeError'
etc
etc
I tried with both ActiveState and Python.org python.
>> I'm not stuck on MinGW, but would love to do this w/o using Visual
> Studio.
>> Open to suggestion. I have a license of VS2005, fwiw, and will use that
>> if it will make life easier, but would rather not if I can help it. I
> am a
>> neophyte when it comes to Visual Studio - I'm not really sure how to
> even
>> start with that - searching the help for "makefile" didn't bring up
>> anything useful.
>
> I use the free Express version of MSVC2008. With the right magic this can
> be configured for 64 bits. I can send you instructions if you want to
> follow this route.
At this point, that would be very welcome. I would love those instructions.
Thank you,
-Brian
More information about the PyQt
mailing list