distutil and debugging

J

Jesper Olsen

Hi,

I have a C-extention build with distutils that I would like to debug.

How can I specify to distuils to pass option "-g" and not "-O2" along to
the compiler (gcc)?

Jesper
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Jesper said:
Hi,

I have a C-extention build with distutils that I would like to debug.

How can I specify to distuils to pass option "-g" and not "-O2" along to
the compiler (gcc)?

python setup.py build --debug

-- Gerhard
 
J

Jesper Olsen

Gerhard Häring said:
python setup.py build --debug

-- Gerhard

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...

Thanks
Jesper
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Jesper said:
[...] 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
 
J

Jesper Olsen

Gerhard Häring said:
Jesper said:
[...] 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top