Jennifer M.
Jennifer M.

Reputation: 1662

What is the easiest way to strip the shared library built by the python-based project?

When compiling a Python C-API project using distutils or setuptools, it results in unstripped .so executables, which are considerably larger in size. Is there a way to easily strip them without calling strip -s manually on the executable? For example, is there an option for this in setup.py?

Upvotes: 2

Views: 212

Answers (2)

Thomas Wagenaar
Thomas Wagenaar

Reputation: 6769

As @phd mentioned, you can skip the manual stripping step by specifying the LDFLAGS=-s environment variable. If you want to automatically do this from setup.py, simply add the following at the start:

import os
os.environ["LDFLAGS"] = "-s"

Upvotes: 0

phd
phd

Reputation: 94726

Set (and export) environment variable LDFLAGS=-s before build steps, i.e.

export LDFLAGS=-s

Upvotes: 5

Related Questions