[ python-Feature Requests-1692592 ] Stripping debugging symbols from compiled C extensions

SourceForge.net noreply at sourceforge.net
Mon Apr 2 01:00:56 CEST 2007


Feature Requests item #1692592, was opened at 2007-04-02 01:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1692592&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Distutils
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Viktor Ferenczi (complex)
Assigned to: Nobody/Anonymous (nobody)
Summary: Stripping debugging symbols from compiled C extensions

Initial Comment:
It would be nice to automatically strip debugging symbols from compiled library files (such as .so files) if a C extension module is not build in debug mode. This could somehow reduce memory footprint and storage requirements for extension modules.

Distutils already does this for cygwin and emx compilers with the following code in cygwinccompiler.py and emxccompiler.py:

# who wants symbols and a many times larger output file
# should explicitly switch the debug mode on
# otherwise we let dllwrap/ld strip the output file
# (On my machine: 10KB < stripped_file < ??100KB
#   unstripped_file = stripped_file + XXX KB
#  ( XXX=254 for a typical python extension))
if not debug:
    extra_preargs.append("-s")

This code should be somehow integrated into base compiler classes such as UnixCCompiler. I've added the following at the beginning of UnixCCompiler.link function:

if not debug:
    if extra_preargs is None:
        extra_preargs = []
    extra_preargs.append("-s")

This works for me with gcc under Linux (Debian Sarge). I does not provide a patch, since this could be the best solution for this.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1692592&group_id=5470


More information about the Python-bugs-list mailing list