distutil and debugging

Jesper Olsen jolsen at mail2world.com
Sun Jul 4 07:52:50 EDT 2004


Gerhard Häring <gh at ghaering.de> wrote in message news:<mailman.393.1088920870.27577.python-list at python.org>...
> Jesper Olsen wrote:
> > [...] No - that does not change the options. I think it only links against a version
> > of the python lib, which has been compiled for debugging.
> > 
> > However, I want to debug my own extention - not the python interpretor.
> > 
> > I'm not the first to have this problem:
> > 
> > http://tinyurl.com/35ddd
> > 
> > but that solution only works for the windows environment.
> > I'm on OpenBSD, and would prefer to stay there also while debugging...
> 
> I don't think that's relevant here. To be honest, I didn't need to add 
> any flags on Linux to debug my extensions. -g always gets added there 
> automatically.
> 
> Perhaps this comment from distutils/unixcompiler.py will help you fixing 
> your build environment:
> 
> #   * optimization/debug/warning flags; we just use whatever's in Python's
> #     Makefile and live with it.  Is this adequate?  If not, we might
> #     have to have a bunch of subclasses GNUCCompiler, SGICCompiler,
> #     SunCCompiler, and I suspect down that road lies madness.
> 
> Maybe your OpenBSD Python was compiled without -g and thus your 
> extensions are compiled without -g as well.
> 
> -- Gerhard

Thanks Gerhard.

I think you are right - it simply grabs the options that were used for
compiling the interpreter. So recompiling the interpreter would
probably solve the problem.

I thought I remembered that it was possible to specify your own
options in the setup.py script - but I can't find it in the online
manual, so maybe it is just
Alzheimer.

The easiest in this situation is probably to not use distutils, and
simply write a normal makefile for creating that .so library.
It is not hard to do, but I wish distutils could autogenerate it, and
let
me edit it. 
Most of the time distutils does a good job, and this would only be a
small
addition given what it does now.

/Jesper



More information about the Python-list mailing list