Hi guys

I'm having problems building PyQt4 from source using MinGW under
Windows XP. Here are the steps I went through, with detail about each
of the problems. I'm hoping this information will help you fix some of
the mess. I also hope that it will be convincing enough to make it
obvious that it is a bit painful right now.


0. - I adjusted my PATH to include C:/MinGW/bin
  - I'm running all of the code below in a Cygwin bash shell.


1. I installed Qt-4.3.0 Open Source using the .exe file from
  trolltech's website.


2. Installing sip: since there is no Windows binary available for sip,
  I downloaded the snapshot source: sip-snapshot-20070704, unzipped
  it. From there I followed the instructions::

     C:/Python25/python.exe configure.py -p win32-g++
     make  # using Cygwin's GNU make
     make install

  **ERROR**, this ``make install`` fails::

    [EMAIL PROTECTED] /cygdrive/c/tmp/sip-snapshot-20070704
    $ make install
    make[1]: Entering directory `/cygdrive/c/tmp/sip-snapshot-20070704/sipgen'
    /bin/sh: -c: line 1: syntax error: unexpected end of file
    make[1]: *** [install] Error 2
    make[1]: Leaving directory `/cygdrive/c/tmp/sip-snapshot-20070704/sipgen'
    make: *** [install] Error 2

  Workaround: I copied the files manually to the Python
  installation::

    cp sip*.py siplib/sip.pyq C:/Python25/Lib/site-packages

  ``import sip`` works from Python. So I'm moving on.


3. Installing PyQt: same, I have to use the snapshot until there is a
  release for 4.3.0.  I downloaded the snapshot (20080710), unpacked
  it, and am trying to configure it::

    $ C:/Python25/python configure.py -p win32-g++
    Determining the layout of your Qt installation...
    Error: Make sure you have a working Qt v4 qmake on your PATH or use the -q
    argument to explicitly specify a working Qt v4 qmake.


  So I look for qmake.exe in the Qt installation, and it is in
  C:/Qt/4.3.0/qmake/qmake.exe, so I do::

    $ C:/Python25/python configure.py -p win32-g++ -q
C:/Qt/4.3.0/qmake/qmake.exe -w
    Determining the layout of your Qt installation...
    C:\Qt\4.3.0\qmake\qmake.exe -o qtdirs.mk qtdirs.pro
    QMAKESPEC has not been set, so configuration cannot be deduced.
    Error processing project file: qtdirs.pro
    Error: C:\Qt\4.3.0\qmake\qmake.exe failed to create a makefile.
Make sure you
    have a working Qt v4 qmake on your PATH or use the -q argument to
explicitly
    specify a working Qt v4 qmake.


  Fine, I'll set QMAKESPEC::

    $ export QMAKESPEC="win32-g++"

  I'll set QTDIR as well::

    $ export QTDIR=C:/Qt/4.3.0

  It still fails::

    $ C:/Python25/python configure.py -p win32-g++ -q
C:/Qt/4.3.0/qmake/qmake.exe -w
    Determining the layout of your Qt installation...
    C:\Qt\4.3.0\qmake\qmake.exe -o qtdirs.mk qtdirs.pro
    Could not find mkspecs for your QMAKESPEC(win32-g++) after trying:
            C:/iwmake/build_mingw_opensource\mkspecs
    Error processing project file: qtdirs.pro
    Error: C:\Qt\4.3.0\qmake\qmake.exe failed to create a makefile.
Make sure you
    have a working Qt v4 qmake on your PATH or use the -q argument to
explicitly
    specify a working Qt v4 qmake.


  **ERROR**: How do I change the root of the ``mkspecs`` files for
  qmake? It does not seem to have an option.

  After a fair amount of searching, I find that QMAKEPATH is the
  variable that will help me here::

    $ export QMAKEPATH=C:/Qt/4.3.0


  (This needs to be document more clearly somewhere, or the problem
  needs to be fixed somehow.)


  Moving on, it still fails::

    $ C:/Python25/python configure.py -p win32-g++ -q
C:/Qt/4.3.0/qmake/qmake.exe -w
    Determining the layout of your Qt installation...
    C:\Qt\4.3.0\qmake\qmake.exe -o qtdirs.mk qtdirs.pro
    mingw32-make -f qtdirs.mk release
    mingw32-make -f qtdirs.mk.Release
    mingw32-make[1]: Entering directory
`c:/tmp/PyQt-win-gpl-4-snapshot-20070710'
    g++ -c -O2 -Wall -fno-exceptions -fno-rtti -DUNICODE
-DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_THREAD_
    ORT -DQT_NEEDS_QMAIN
-I'c:/iwmake/build_mingw_opensource/include/QtCore'
-I'c:/iwmake/build_mingw_opensource/include
    'c:/iwmake/build_mingw_opensource/include/ActiveQt' -I'release'
-I'.' -I'../../Qt/4.3.0/mkspecs/win32-g++' -o releas
    dirs.o qtdirs.cpp
    qtdirs.cpp:1:17: QFile: No such file or directory
    qtdirs.cpp:2:24: QLibraryInfo: No such file or directory
    qtdirs.cpp:3:23: QTextStream: No such file or directory
    qtdirs.cpp: In function `int main(int, char**)':
    qtdirs.cpp:7: error: `QFile' undeclared (first use this function)
    qtdirs.cpp:7: error: (Each undeclared identifier is reported only
once for each function it appears in.)
    qtdirs.cpp:7: error: expected `;' before "outf"
    qtdirs.cpp:9: error: `outf' undeclared (first use this function)
    qtdirs.cpp:9: error: `QIODevice' has not been declared
    qtdirs.cpp:9: error: `WriteOnly' undeclared (first use this function)
    qtdirs.cpp:9: error: `QIODevice' has not been declared
    qtdirs.cpp:9: error: `Truncate' undeclared (first use this function)
    qtdirs.cpp:9: error: `QIODevice' has not been declared
    qtdirs.cpp:9: error: `Text' undeclared (first use this function)
    qtdirs.cpp:12: error: `QTextStream' undeclared (first use this function)
    qtdirs.cpp:12: error: expected `;' before "out"
    qtdirs.cpp:14: error: `out' undeclared (first use this function)
    qtdirs.cpp:14: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:14: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:14: error: `PrefixPath' undeclared (first use this function)
    qtdirs.cpp:14: error: `location' undeclared (first use this function)
    qtdirs.cpp:15: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:15: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:15: error: `HeadersPath' undeclared (first use this function)
    qtdirs.cpp:16: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:16: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:16: error: `LibrariesPath' undeclared (first use this function)
    qtdirs.cpp:17: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:17: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:17: error: `BinariesPath' undeclared (first use this function)
    qtdirs.cpp:18: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:18: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:18: error: `DataPath' undeclared (first use this function)
    qtdirs.cpp:19: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:19: error: `QLibraryInfo' has not been declared
    qtdirs.cpp:19: error: `PluginsPath' undeclared (first use this function)
    mingw32-make[1]: *** [release/qtdirs.o] Error 1
    mingw32-make[1]: Leaving directory
`c:/tmp/PyQt-win-gpl-4-snapshot-20070710'
    mingw32-make: *** [release] Error 2
    Error: Failed to create release\qtdirs.exe. Make sure you have a
working Qt v4
    qmake on your PATH or use the -q argument to explicitly specify a
working Qt v4
    qmake.

  ``qmake.exe` is apparently still looking at
  ``c:/iwmake/build_mingw_opensource``.

  **ERROR** After spending 45mins fiddling with numerous variables
  that I would expect to influence qmake (searching a lot on the
  web), I cannot seem to make it change the include file.  How do I
  do that?



  Allright, so I can't do this, damnit. Fine, I'll copy QTDIR where
  it wants it, let's move into kludge-paradise::

    $ cd C:/
    $ mkdir -p C:/iwmake
    $ cp -r C:/Qt/4.3.0 C:/iwmake/build_mingw_opensource

  This time it cannot find my mingw32::

    $ C:/Python25/python configure.py -p win32-g++ -q
C:/Qt/4.3.0/qmake/qmake.exe -w
    Determining the layout of your Qt installation...
    C:\Qt\4.3.0\qmake\qmake.exe -o qtdirs.mk qtdirs.pro
    mingw32-make -f qtdirs.mk release
    mingw32-make -f qtdirs.mk.Release
    mingw32-make[1]: Entering directory
`c:/tmp/PyQt-win-gpl-4-snapshot-20070710'
    g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE
-DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQ
    T_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I'../../iwmake/build_mingw_opensource/include/QtCore'
-I'../../iwmake/build_mingw_ope
    nsource/include/QtCore'
-I'../../iwmake/build_mingw_opensource/include'
-I'../../iwmake/build_mingw_opensource/include/A
    ctiveQt' -I'release' -I'.' -I'../../Qt/4.3.0/mkspecs/win32-g++'
-o release/qtdirs.o qtdirs.cpp
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,w
    indows -o "release/qtdirs.exe" release/qtdirs.o
-L'c:/iwmake/build_mingw_opensource/lib' -lmingw32 -lqtmain -lQtCore4
    /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
cannot find -lmingw32
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [release/qtdirs.exe] Error 1
    mingw32-make[1]: Leaving directory
`c:/tmp/PyQt-win-gpl-4-snapshot-20070710'
    mingw32-make: *** [release] Error 2
    Error: Failed to create release\qtdirs.exe. Make sure you have a
working Qt v4
    qmake on your PATH or use the -q argument to explicitly specify a
working Qt v4
    qmake.

  Oh, that's easy, my PATH is set wrong, I need to compile with
  MinGW, not Cygwin's gcc::

    $ export PATH=/cygdrive/c/MinGW/bin:$PATH

  Retrying::

    $ C:/Python25/python configure.py -p win32-g++ -q
C:/Qt/4.3.0/qmake/qmake.exe -w
    Determining the layout of your Qt installation...
    C:\Qt\4.3.0\qmake\qmake.exe -o qtdirs.mk qtdirs.pro
    mingw32-make -f qtdirs.mk release
    mingw32-make -f qtdirs.mk.Release
    mingw32-make[1]: Entering directory
`c:/tmp/PyQt-win-gpl-4-snapshot-20070710'
    g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE
-DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQ
    T_THREAD_SUPPORT -DQT_NEEDS_QMAIN
-I'../../iwmake/build_mingw_opensource/include/QtCore'
-I'../../iwmake/build_mingw_ope
    nsource/include/QtCore'
-I'../../iwmake/build_mingw_opensource/include'
-I'../../iwmake/build_mingw_opensource/include/A
    ctiveQt' -I'release' -I'.' -I'../../Qt/4.3.0/mkspecs/win32-g++'
-o release/qtdirs.o qtdirs.cpp
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,w
    indows -o "release/qtdirs.exe" release/qtdirs.o
-L'c:/iwmake/build_mingw_opensource/lib' -lmingw32 -lqtmain -lQtCore4
    mingw32-make[1]: Leaving directory
`c:/tmp/PyQt-win-gpl-4-snapshot-20070710'
    release\qtdirs.exe
    Error: Unable to find the qmake configuration file
    C:\Qt\4.2.2\mkspecs\win32-g++\qmake.conf. Use the QMAKESPEC environment
    variable to specify the correct platform.

  Look at that 4.2.2, what is that?  So I grep and find it in
  configure.py::

    $ grep -sr 4.2.2 .
    ...
    ./configure.py:            0x040202: "Qt_4_2_0",
    ./configure.py:            0x040300: "Qt_4_2_2",
    ...

  Looks like a bug. I edit configure.py::

    $ diff -Naur configure.py  configure.new.py
    --- configure.py        2007-07-11 12:02:54.387145300 -0700
    +++ configure.new.py    2007-07-11 12:03:12.824645300 -0700
    @@ -218,7 +218,7 @@
                 0x040103: "Qt_4_1_2",
                 0x040200: "Qt_4_1_3",
                 0x040202: "Qt_4_2_0",
    -            0x040300: "Qt_4_2_2",
    +            0x040300: "Qt_4_3_0",
                 0x050000: "Qt_4_3_0"
             }

  It does not make a difference, same error.

  I grep all over, in my Qt installation, in PyQt, to no avail.

  I ran a find on my system, there is not other libQtCore4.a other
  than the newly installed one in C:/Qt/4.3.0/lib/libQtCore4.a.


Any help appreciated. I'm stuck. Well, you know, for now. Stuck for now.
(It's a little painful and fiddling with Windows I feel like my life
is passing me by, you know.)
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to