buildroot/package/python3
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
..
0001-Make-the-build-of-pyc-files-conditional.patch
0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch
0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch
0004-Adjust-library-header-paths-for-cross-compilation.patch
0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch
0006-Don-t-add-multiarch-paths.patch
0007-Abort-on-failed-module-build.patch
0008-Serial-ioctl-workaround.patch
0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch
0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch
0011-Add-an-option-to-disable-pydoc.patch
0012-Add-an-option-to-disable-lib2to3.patch
0013-Add-option-to-disable-the-sqlite3-module.patch
0014-Add-an-option-to-disable-the-tk-module.patch
0015-Add-an-option-to-disable-the-curses-module.patch
0016-Add-an-option-to-disable-expat.patch
0017-Add-an-option-to-disable-CJK-codecs.patch
0018-Add-an-option-to-disable-NIS.patch
0019-Add-an-option-to-disable-unicodedata.patch
0020-Add-an-option-to-disable-IDLE.patch
0021-Add-an-option-to-disable-decimal.patch
0022-Add-an-option-to-disable-the-ossaudiodev-module.patch
0023-Add-an-option-to-disable-openssl-support.patch
0024-Add-an-option-to-disable-the-readline-module.patch
0025-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch
0026-python-config.sh-don-t-reassign-prefix.patch
0027-Add-an-option-to-disable-uuid-module.patch
0028-fix-building-on-older-distributions.patch
0029-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch
0030-Add-an-option-to-disable-the-berkeleydb-module.patch
0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch
Config.in
Config.in.host
python3.hash
python3.mk