You can see that some files are missing, such as Modules/_posixsubprocess.o
Then these missed files builded into .so libraries. What doesn't happen during building python3.11, from logs:
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_asyncio _bisect _blake2
_codecs_cn _codecs_hk _codecs_iso2022
_codecs_jp _codecs_kr _codecs_tw
_contextvars _crypt _csv
_ctypes _ctypes_test _datetime
_elementtree _gdbm _heapq
_json _lsprof _lzma
_md5 _multibytecodec _multiprocessing
_opcode _pickle _posixshmem
_posixsubprocess _queue _random
_sha1 _sha256 _sha3
_sha512 _socket _statistics
_struct _typing _zoneinfo
array audioop binascii
cmath fcntl grp
math mmap ossaudiodev
pyexpat resource select
spwd syslog termios
unicodedata zlib
As far as I can understand, because of this I get the following result on the builded python3.12:
Python 3.12.0 (main, Feb 14 2024, 22:34:23) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: Dynamic loading not supported
>>> import _posixsubprocess
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: Dynamic loading not supported
>>> import _operator
>>> import _stat
>>>
Also see the difference between logs :
In python 3.11 I got:
*** WARNING: renaming "_xxsubinterpreters" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_testcapi" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_testclinic" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_testinternalcapi" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_testbuffer" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_testimportmultiple" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_testmultiphase" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_xxtestfuzz" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "readline" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_dbm" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "nis" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_decimal" since importing it failed: Dynamic loading not supported
*** WARNING: renaming "_uuid" since importing it failed: Dynamic loading not supported
In 3.12:
maksetup: '_sha2' was handled by previous rule.
maksetup: '_sha3' was handled by previous rule.
maksetup: '_codecs_cn' was handled by previous rule.
maksetup: '_codecs_hk' was handled by previous rule.
maksetup: '_codecs_iso2022' was handled by previous rule.
maksetup: '_codecs_jp' was handled by previous rule.
maksetup: '_codecs_kr' was handled by previous rule.
maksetup: '_codecs_tw' was handled by previous rule.
maksetup: '_multibytecodec' was handled by previous rule.
maksetup: 'unicodedata' was handled by previous rule.
maksetup: '_posixsubprocess' was handled by previous rule.
maksetup: '_posixshmem' was handled by previous rule.
maksetup: 'fcntl' was handled by previous rule.
maksetup: 'grp' was handled by previous rule.
maksetup: 'ossaudiodev' was handled by previous rule.
maksetup: 'resource' was handled by previous rule.
maksetup: 'spwd' was handled by previous rule.
maksetup: 'syslog' was handled by previous rule.
maksetup: 'termios' was handled by previous rule.
maksetup: '_crypt' was handled by previous rule.
maksetup: '_ctypes' was handled by previous rule.
maksetup: '_gdbm' was handled by previous rule.
maksetup: '_lzma' was handled by previous rule.
maksetup: 'zlib' was handled by previous rule.
maksetup: '_ctypes_test' was handled by previous rule.
...
also
make: [Makefile:2382: libinstall] Error 1 (ignored)
Traceback (most recent call last):
File "/home/arman/IspCode/jetos.python/ispras-python/lib/python3.12/compileall.py", line 17, in <module>
import struct
File "/home/arman/IspCode/jetos.python/ispras-python/lib/python3.12/struct.py", line 13, in <module>
from _struct import *
ImportError: Dynamic loading not supported
make: [Makefile:2383: libinstall] Error 1 (ignored)
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/arman/IspCode/jetos.python/src/Python/Python-3.12.0/Lib/lib2to3/pgen2/driver.py", line 26, in <module>
from . import grammar, parse, token, tokenize, pgen
File "/home/arman/IspCode/jetos.python/src/Python/Python-3.12.0/Lib/lib2to3/pgen2/grammar.py", line 16, in <module>
import pickle
File "/home/arman/IspCode/jetos.python/src/Python/Python-3.12.0/Lib/pickle.py", line 33, in <module>
from struct import pack, unpack
File "/home/arman/IspCode/jetos.python/src/Python/Python-3.12.0/Lib/struct.py", line 13, in <module>
from _struct import *
ImportError: Dynamic loading not supported
make: [Makefile:2384: libinstall] Error 1 (ignored)
It looks like Modules/Setup doesn't work in 3.12 like in 3.11...
I attached Setup files into issue.
Setup_3.11.txtSetup_3.12.txt
Building:
if [ $PYTHON_BASE_VERSION -ge 11 ]; then
CONFIGURE_FLAGS="--without-ensurepip --with-trace-refs"
fi
if [ $PYTHON_BASE_VERSION -ge 12 ]; then
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-system-libmpdec"
fi
CFLAGS="-fPIC -static -I${SRC_DIR}/dependencies/include" \
LDFLAGS="-L${SRC_DIR}/dependencies/lib -static" LIBS="-lz -lexpat" \
../"Python-${PYTHON_VERSION}/configure" ${CONFIGURE_FLAGS} --prefix="${SRC_DIR}/${PYTHON_DIR}" \
--disable-shared --without-doc-strings --with-system-expat || xtfatal "Unable to configure Python"
if [ "$(uname)" = "Linux" ]; then
make "$PARALLEL_NUM" LDFLAGS="-static" LINKFORSHARED=" " || xtfatal "Unable to make Python"
else
make "$PARALLEL_NUM" || xtfatal "Unable to make Python"
fi
make install || xtfatal "Unable to install Python"
Can you please tell me how to add necessary objects to the static library 3.12?
Bug report
Bug description:
I'm building python statically.
In python3.11.8 I have this output:
But in 3.12 I have this:
You can see that some files are missing, such as Modules/_posixsubprocess.o
Then these missed files builded into .so libraries. What doesn't happen during building python3.11, from logs:
As far as I can understand, because of this I get the following result on the builded python3.12:
Also see the difference between logs :
In python 3.11 I got:
In 3.12:
also
It looks like Modules/Setup doesn't work in 3.12 like in 3.11... I attached Setup files into issue. Setup_3.11.txt Setup_3.12.txt
Building:
Can you please tell me how to add necessary objects to the static library 3.12?
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux