python statlic lib embedding

python static lib因为默认没有编译内置库,因此需要配置setup.local文件,把内置库编译到static lib。
参考:https://wiki.python.org/moin/BuildStatically。(./configure --disable-shared即可)
注意是Setup.local,不是Setup.dist

*static*

# GNU readline.  Unlike previous Python incarnations, GNU readline is
# now incorporated in an optional module, configured in the Setup file
# instead of by a configure script switch.  You may have to insert a
# -L option pointing to the directory where libreadline.* lives,
# and you may have to change -ltermcap to -ltermlib or perhaps remove
# it, depending on your system -- see the GNU readline instructions.
# It's okay for this to be a shared library, too.

#readline readline.c -lreadline -ltermcap


# Modules that should always be present (non UNIX dependent):

array arraymodule.c	# array objects
cmath cmathmodule.c _math.c # -lm # complex math library functions
math mathmodule.c _math.c # -lm # math library functions, e.g. sin()
_contextvars _contextvarsmodule.c  # Context Variables
_struct _struct.c	# binary structure packing/unpacking
_weakref _weakref.c	# basic weak reference support
_testcapi _testcapimodule.c    # Python C API test module
_random _randommodule.c	# Random number generator
_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c	# elementtree accelerator
_pickle _pickle.c	# pickle accelerator
_datetime _datetimemodule.c	# datetime accelerator
_bisect _bisectmodule.c	# Bisection algorithms
_heapq _heapqmodule.c	# Heap queue algorithm
_asyncio _asynciomodule.c  # Fast asyncio Future

unicodedata unicodedata.c    # static Unicode character database


# Modules with some UNIX dependencies -- on by default:
# (If you have a really backward UNIX, select and socket may not be
# supported...)

fcntl fcntlmodule.c	# fcntl(2) and ioctl(2)
spwd spwdmodule.c		# spwd(3)
grp grpmodule.c		# grp(3)
select selectmodule.c	# select(2); not on ancient System V

# Memory-mapped files (also works on Win32).
mmap mmapmodule.c

# CSV file helper
_csv _csv.c
posted @ 2024-03-21 13:43  xuyv  阅读(5)  评论(0编辑  收藏  举报