[PyQt] debug builds under windows

Nathan Weston nathan at genarts.com
Sat Apr 14 13:52:57 BST 2012


On 04/14/2012 05:16 AM, Erik Janssens wrote:
> Hi,
>
> How are debug builds supposed to work under windows ?
>
> I'm observing a segfault that I can only reproduce on
> windows, and would like to create a stackstrace.
>
> I've build Qt in debug mode.  But when building sip
> with --debug, it appears that the dll is named sip_d
> instead of sip, making the dll unimportable.
>
> On a side note : I tried to build python itself in debug
> mode, resulting in a python_d.exe.  however this exe even
> fails to import things like os or sys.
>
> Thanks,
>
> Erik

I was in a similar situation a few months ago, and I eventually got it 
to work, but it took me a couple days of struggling with it.

You have to rebuild everything in debug mode -- Python, Qt, SIP, and 
PyQt. The python build went smoothly for me and I didn't run into a 
problem like you describe -- maybe you need to adjust your PATH?

In case it helps, here are the notes I wrote myself at the time:

  1. Build a debug version of Python. This was pretty straightforward, 
just used the Visual Studio project in PC/VS8.0 (for VS2005 -- I didn't 
see any support for later versions).
  2. Build Qt.
   * Download the zip file of the source distribution -- the tarball has 
a configure shell script, but not the configure.exe which you need for a 
windows build.
   * Open up a Visual Studio command prompt
   * Run configure
   * Build with nmake
  3. Build SIP.
   * Set LIB to point to your python build
   * Run configure with your debug python
   * Build with nmake install
  4. Build PyQt
   * Make sure that qmake from your Qt build is in the path.
   * Configure and build as above
   * I had to edit Makefile.release in the designer subdir to link the 
Python/Qt debug libs. There's also Makefile.debug but my build didn't 
use it.
   * After all that, I kept getting a link error about python26.lib -- 
which doesn't exist b/c the debug build has python26_d.lib. I couldn't 
find the problem anywhere in the Makefiles, so I just copied the lib 
from my regular Python 2.6 install. The build finished and it seems to work.
  5. Put the debug version of Qt in your PATH

I had one more weird problem when I actually ran this in the debugger: 
the DLLs in $QTDIR/bin don't give me any stack traces, b/c there are no 
PDBs there. So I had to point the path at $QTDIR/lib instead -- which 
contains another set of the DLLs (not sure if they're identical or not) 
as well as corresponding PDBs. Then it works fine.


-- 
. . . . . . . . . . . . . . . . . . . . . . . . .
Nathan Weston                   nathan at genarts.com
GenArts, Inc.                   Tel: 617-492-2888
955 Mass. Ave                   Fax: 617-492-2852
Cambridge, MA 02139 USA         www.genarts.com


More information about the PyQt mailing list