kumquat-buildroot/package/python3/Config.in
Bernd Kuhls b84ffd85e2 package/python3: berkeleydb support needs the dbm interface
Until now, the Python build system was building a _dbm.cpython-*.so
native module when BR2_PACKAGE_PYTHON3_BERKELEYDB was enabled, but
since the bump of Python to 3.11.x, it was no longer building this
native module.

Investigation this, we found out that Python 3.11 changed how libdb
was detected [1] and that check now fails:

quoting configure log:
checking for libdb... no

quoting python config.log:
conftest.c:(.text.startup+0x8): undefined reference to `__db_ndbm_open'

However, in fact it turns that this problem is not new in Python
3.11. In Python 3.10, the build system was always producing the native
module, but it was in fact not working at runtime:

>>> from _dbm import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/lib/python3.10/lib-dynload/_dbm.cpython-310-arm-linux-gnueabihf.so: undefined symbol: __db_ndbm_delete

It was not really visible because when one does "import dbm", it
actually tries several "backends", including ndbm (which relies on
_dbm above), and if it doesn't work, it falls back silently on a pure
Python implementation.

So the issue was never noticed, but has already been there,
potentially forever.

In order for this _dbm native module to be built (Python >= 3.11) or
to work (Python < 3.11), the BerkeleyDB library need to be built with
its so-called "dbm" interface, which we do by selecting select
BR2_PACKAGE_BERKELEYDB_DBM.

And now:

>>> import _dbm
>>>

[1] d2340ef257/configure.ac (L4002)

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[Thomas: did more research to have a better explanation of what is
happening, and realize the problem is not related to Python 3.11]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023-08-09 20:16:38 +02:00

132 lines
2.9 KiB
Plaintext

comment "python3 needs a toolchain w/ wchar, threads, dynamic library"
depends on BR2_USE_MMU
depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
config BR2_PACKAGE_PYTHON3
bool "python3"
depends on BR2_USE_WCHAR
# uses fork()
depends on BR2_USE_MMU
depends on BR2_TOOLCHAIN_HAS_THREADS # libffi
depends on !BR2_STATIC_LIBS
select BR2_PACKAGE_LIBFFI
select BR2_PACKAGE_BLUEZ5_UTILS_HEADERS if BR2_PACKAGE_BLUEZ5_UTILS
help
The python language interpreter.
http://www.python.org/
if BR2_PACKAGE_PYTHON3
choice
prompt "python3 module format to install"
default BR2_PACKAGE_PYTHON3_PYC_ONLY
help
Select Python module format to install on target (py, pyc or
both)
config BR2_PACKAGE_PYTHON3_PY_ONLY
bool ".py sources only"
config BR2_PACKAGE_PYTHON3_PYC_ONLY
bool ".pyc compiled sources only"
config BR2_PACKAGE_PYTHON3_PY_PYC
bool ".py sources and .pyc compiled"
endchoice
menu "core python3 modules"
comment "The following modules are unusual or require extra libraries"
config BR2_PACKAGE_PYTHON3_2TO3
bool "2to3 module"
help
code translation from python 2 to 3
config BR2_PACKAGE_PYTHON3_BERKELEYDB
bool "berkeleydb"
select BR2_PACKAGE_BERKELEYDB
select BR2_PACKAGE_BERKELEYDB_DBM
help
berkeleydb module for Python3
config BR2_PACKAGE_PYTHON3_BZIP2
bool "bz2 module"
select BR2_PACKAGE_BZIP2
help
bzip2 module for Python3
config BR2_PACKAGE_PYTHON3_CODECSCJK
bool "codecscjk module"
help
Chinese/Japanese/Korean codecs module for Python (large).
config BR2_PACKAGE_PYTHON3_CURSES
bool "curses module"
select BR2_PACKAGE_NCURSES
help
curses module for Python3.
config BR2_PACKAGE_PYTHON3_DECIMAL
bool "decimal module"
select BR2_PACKAGE_MPDECIMAL
help
decimal module for Python3.
config BR2_PACKAGE_PYTHON3_OSSAUDIODEV
bool "ossaudiodev module"
help
ossaudiodev module for Python3.
config BR2_PACKAGE_PYTHON3_READLINE
bool "readline"
select BR2_PACKAGE_READLINE
help
readline module for Python3 (required for command-line
editing in the Python shell).
config BR2_PACKAGE_PYTHON3_SSL
bool "ssl"
select BR2_PACKAGE_OPENSSL
select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL
select BR2_PACKAGE_LIBOPENSSL_ENABLE_BLAKE2
help
_ssl module for Python3 (required for https in urllib etc).
config BR2_PACKAGE_PYTHON3_UNICODEDATA
bool "unicodedata module"
default y
help
Unicode character database (used by stringprep module)
(large).
config BR2_PACKAGE_PYTHON3_SQLITE
bool "sqlite module"
select BR2_PACKAGE_SQLITE
help
SQLite database support
config BR2_PACKAGE_PYTHON3_PYEXPAT
bool "xml module"
select BR2_PACKAGE_EXPAT
help
pyexpat and xml libraries for Python3.
config BR2_PACKAGE_PYTHON3_XZ
bool "xz module"
select BR2_PACKAGE_XZ
help
xz (a.k.a lzma) module for Python3
config BR2_PACKAGE_PYTHON3_ZLIB
bool "zlib module"
select BR2_PACKAGE_ZLIB
help
zlib support in Python3
endmenu
endif