473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

distutil and debugging

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
Jul 18 '05 #1
4 2263
Jesper Olsen wrote:
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

Jul 18 '05 #2
Gerhard Häring <gh@ghaering.de> wrote in message news:<ma**************************************@pyt hon.org>...
Jesper Olsen wrote:
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


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
Jul 18 '05 #3
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

Jul 18 '05 #4
Gerhard Häring <gh@ghaering.de> wrote in message news:<ma**************************************@pyt hon.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
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Holger Joukl | last post by:
Hi, what version of python are you using? I got the same error when invoking a customized, 2-year-old version of distutils with python 2.3.3 (instead of 1.5.2, as before). Reason is code in...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
2
by: Andy Fish | last post by:
Hi, Using VS.NET 2003, when I use 'F5' to start debugging my web app, it obviously attaches the IDE to IIS for server debugging. However, it also seems to put IE into some kind of debugging mode...
5
by: Velvet | last post by:
Can someone tell me to what process I need to attach to be able to step through my classic ASP code in VS.net 2003. I'm working on an XP box with IIS installed. I also have VS.net 2005 (The...
5
by: phnimx | last post by:
Hi , We have developed a number of plug-in .NET Library Components that we typically deploy with our various applications by installing them into the GAC. Each of the applications contains an...
0
by: =?GB2312?B?zPC5zw==?= | last post by:
Howdy, This problem have puzzled me for a long time. I usually use python2.5 in Windows, while VC2005 is installed. However python25.lib is compiled by VC2003. When I use disutil to build some C...
1
by: =?GB2312?B?zPC5zw==?= | last post by:
The problem is not compiler, but runtime. For example, if python is Thank you for providing this document. Indeed, passing internal pointers of one CRT lib to another is dangerous. But in most...
4
by: =?Utf-8?B?TWlrZSBHYWxl?= | last post by:
VS 2008 initially didn't debug classic ASP. SP1 fixes this in some ways. You can debug if you select the debug option to "Start Without Debugging, then either attach the debugger manually or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.