On 18-mei-2006, at 16:11, William Kyngesburye wrote:

>
> On May 18, 2006, at 2:14 AM, Ronald Oussoren wrote:
>
>>
>> On 18-mei-2006, at 5:29, William Kyngesburye wrote:
>>
>>> Is there some way to customize or override the build flags for
>>> building a Python extension (a C library wrapper)?
>>>
>>> My main problem is that it adds the -g debug flag, ballooning the
>>> size of the module.  I want to build WITHOUT the -g flag.
>>
>> It is possible to add additonal flags, but that won't help you  
>> because you want to remove an existing flag and that is not  
>> possible. GCC also doesn't have a flag that negates the -g flag.
>>
>> If you want to remove the debugging information you can use the  
>> strip command to remove this from the compiled extension.
>>
> I've had mostly bad luck with stripping libraries - it would  
> sometimes create an unstable or broken library.  I'd prefer not  
> using -g in the first place.
>
> Is there maybe a python config file with the flags that distutils  
> uses?  I looked around a bit in the framework but didn't see  
> anything.  Or is that built into the python binary/library?

The build flags are in /Library/Frameworks/Python.framework/Versions/ 
Current/lib/python2.4/config/Makefile (BASECFLAGS and LDFLAGS)

>
>
>> But, why do care about the size of the compiled extension?  Disk  
>> space is cheap these days ;-).
>
> Disk space is cheap, but not always download bandwidth.  I build  
> and package this for others.
>
> And I'm a frugal person and like things compact, with little  
> bloat.  One library I've built was a difference of 20MB with debug  
> or 2MB optimized (and that's one of those where I had problems  
> stripping it).  An application (in constant development) was  
> something like 150MB or 35MB.  Add to that the doubling affect of  
> universal builds now...

Ouch, that is a very significant difference.

>
>
>> Furthermore, if you redistribute the extension as part of an  
>> applicationt that is build using py2app the extension will be  
>> stripped when it is stuffed inside the application bundle.
>>
> It's not really meant for application use, but as a part of using  
> Python for web serving.  Another reason for being small - less to  
> load, and reload..., into memory for the webserver.

That's not really an issue, the loader will only load the parts of  
the extension that are actually used, which excludes debugging  
information.

Ronald
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to