From b84ffd85e2900741bb97325b53d09e170e941e6c Mon Sep 17 00:00:00 2001 From: Bernd Kuhls Date: Tue, 8 Aug 2023 20:50:54 +0200 Subject: [PATCH] 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 "", line 1, in 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] https://github.com/python/cpython/blob/d2340ef25721b6a72d45d4508c672c4be38c67d3/configure.ac#L4002 Signed-off-by: Bernd Kuhls [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 --- package/python3/Config.in | 1 + 1 file changed, 1 insertion(+) diff --git a/package/python3/Config.in b/package/python3/Config.in index 761c38c850..38f0580aa4 100644 --- a/package/python3/Config.in +++ b/package/python3/Config.in @@ -48,6 +48,7 @@ config BR2_PACKAGE_PYTHON3_2TO3 config BR2_PACKAGE_PYTHON3_BERKELEYDB bool "berkeleydb" select BR2_PACKAGE_BERKELEYDB + select BR2_PACKAGE_BERKELEYDB_DBM help berkeleydb module for Python3