[wx-dev] Problems with building a debug version of
wxPython-2.6.3.2
Robin Dunn
robin at alldunn.com
Fri Jul 28 12:48:45 PDT 2006
Susarla, Aditya wrote:
> Hi Folks,
>
> I am having problems building a debug version of wxPython-2.6.3.2
>
> *_Intent:_** *is to build a debug version of wxPython-2.6.3.2 without
> _requiring debug versions of python and other extensions_. I am able to
> build the debug version of wxWidgets without problems. Also I am _using
> python version 2.3 ._
>
> *_Background:_*
>
> My wxPython application uses wxTreeListCtrl class (which gets compiled
> into _gizmos.pyd in the wxpython installation).
>
> My application crashes when using the treelistctrl and the crash is
> happening in the _gizmos.pyd . As far as I can tell, my application is
> not doing anything that may cause the crash. So what I have been trying
> to do is to compile _gizmos.pyd in the debug mode so that I can set
> break points in the treelistctrl.cpp file ( present at the
> ..\wxPython\contrib\gizmos\wxCode\src\treelistctrl.cpp in the wxpython
> source code installation directory ). However I do not have debug
> versions of python and other extensions. Hence I want to either :
>
> * build debug version of wxPython (along with debug versions of
> wxWidgets) without requiring debug versions of python. This is the
> most desirable option
>
> OR
>
> * build a non-debug version of wxPython with debugging info turned
> on in some files ( like treelistctrl.cpp) so that I can set break
> points in that file.
>
>
>
> *Problem:*
>
> I have been unable to figure out a way to build a debug version of
> wxPython ( mentioned in the first bullet above). I have tried the second
> option but running the wxPython app in the MSVC 7.1 debugger leads to
> user-breakpoints that I cannot seem to get rid of. Also I am not able to
> successfully set break points in the files compiled with debugging
> information.
I don't have time right now to read your message in a lot of detail,
(I'm in a conference session at the moment) but I do have some
information on what needs to be done to get a debuggable python module
that can be run with the non-debug version of Python. It's been a few
years since I've done this some some things may have changed in that
time, but this should at least get you pointed in the right direction.
There are two bacic things that need to be done. First, you need to
make sure that wxPython is compiled with the right flags to use the
non-debug version of the C runtime library, so that both Python and
wxPython are using the same one. (/MD vs. /MDd) So to do this you need
to build wxWidgets with "DEBUG_RUNTIME_LIBS=0" on the nmake
command-line. You'll also need to make sure that the /MD flag is used
in the compilation of wxPython, but I think you'll need to hack
something in to wxPython's config.py to do it.
The second thing that needs to change is that Python by default will
expect to build a module with a _d postfix for use in the debug version
of the interpreter. It also will link the extensions to a _d version of
the python DLL. You'll need to get the build to drop the use of the
_d's, but still compile with the debug flags. The first part of this
will need a hack to one of the python headers, because they include a
#pragma that specifies the _d version of the Python lib. Take a look at
pyconfig.h to get rid of that. The other part of this problem is that
distutils is automatically naming the built extensions with the _d when
the debug flags are used. Distutils doesn't give a lot of flexibility
in this area of what kind of builds it can do, it either does release or
debug, so I think the easiest way to do what you need is to again hack
config.py a bit and add the debug compile and link flags to cflags and
lflags lists, but when you run the build to not use the --debug flag so
it will build it as if it is a release build.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list