package/berkeleydb: add option for historic dbm interface
PATCH 1/2 package/berkeleydb: add option for historic dbm interface
Berkeley DB support in python depends on dbm, when missing python fails to detect libdb:
https://github.com/python/cpython/blob/d2340ef25721b6a72d45d4508c672c4be38c67d3/configure.ac#L4002
quoting python configure log:
checking for libdb... no
quoting python config.log:
conftest.c:(.text.startup+0x8): undefined reference to `__db_ndbm_open'
This patch provides a configure option for the historic dbm interface to be used by the python package.
--- package/berkeleydb/Config.in | 5 +++++ package/berkeleydb/berkeleydb.mk | 1 + 2 files changed, 6 insertions(+)
package/berkeleydb/Config.in +5 -0
@@ -13,6 +13,11 @@ config BR2_PACKAGE_BERKELEYDB_COMPAT185 help Build and install DB 1.85 compatibility API. +config BR2_PACKAGE_BERKELEYDB_DBM + bool "historic dbm interface" + help + Enable the historic dbm interface. + config BR2_PACKAGE_BERKELEYDB_TOOLS bool "install tools" help
package/berkeleydb/berkeleydb.mk +1 -0
@@ -39,6 +39,7 @@ define BERKELEYDB_CONFIGURE_CMDS --disable-java \ --disable-tcl \ $(if $(BR2_PACKAGE_BERKELEYDB_COMPAT185),--enable-compat185,--disable-compat185) \ + $(if $(BR2_PACKAGE_BERKELEYDB_DBM),--enable-dbm,--disable-dbm) \ $(SHARED_STATIC_LIBS_OPTS) \ --with-pic \ --enable-o_direct \
Signature · 6 lines
2.39.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/python3: berkeleydb support needs the dbm interface
Berkeley DB support in python depends on dbm, when missing python fails to detect libdb:
https://github.com/python/cpython/blob/d2340ef25721b6a72d45d4508c672c4be38c67d3/configure.ac#L4002
quoting configure log:
checking for libdb... no
quoting python config.log:
conftest.c:(.text.startup+0x8): undefined reference to `__db_ndbm_open'
Only with this patch python builds a berkeleydb module:
output/build/python3-3.11.4$ find -iname *dbm*.so ./build/lib.linux-x86_64-3.11/_dbm.cpython-311-x86_64-linux-gnu.so
since python 3.11 (added with buildroot commit 738500c296c8b1206f20e94ca3e7c5932a6a0486) changed the way it detects libdb:
https://github.com/python/cpython/commit/0a9f69539be27acf1cddf1b58d02a88d02e5008d
--- package/python3/Config.in | 1 + 1 file changed, 1 insertion(+)
package/python3/Config.in +1 -0
@@ -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
Signature · 6 lines
2.39.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 2/2] package/python3: berkeleydb support needs the dbm interface
Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Bernd" == Bernd Kuhls <[email protected]> writes:
Berkeley DB support in python depends on dbm, when missing python fails to detect libdb:
https://github.com/python/cpython/blob/d2340ef25721b6a72d45d4508c672c4be38c67d3/configure.ac#L4002quoting configure log:
checking for libdb... noquoting python config.log:
conftest.c:(.text.startup+0x8): undefined reference to `__db_ndbm_open'Only with this patch python builds a berkeleydb module:
Quoted 8 lines
output/build/python3-3.11.4$ find -iname *dbm*.so ./build/lib.linux-x86_64-3.11/_dbm.cpython-311-x86_64-linux-gnu.so
since python 3.11 (added with buildroot commit
738500c296c8b1206f20e94ca3e7c5932a6a0486) changed the way it detects libdb:
https://github.com/python/cpython/commit/0a9f69539be27acf1cddf1b58d02a88d02e5008dSigned-off-by Bernd Kuhls <[email protected]>
Committed to 2023.02.x and 2023.05.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Bernd,
Quoted 7 lines · On Mon, 7 Aug 2023 19:45:14 +0200 Bernd Kuhls <[email protected]> wrote:
Berkeley DB support in python depends on dbm, when missing python fails to detect libdb:
https://github.com/python/cpython/blob/d2340ef25721b6a72d45d4508c672c4be38c67d3/configure.ac#L4002quoting python configure log:
checking for libdb... no
Quoted 7 lines
quoting python config.log:
conftest.c:(.text.startup+0x8): undefined reference to `__db_ndbm_open'This patch provides a configure option for the historic dbm interface to be used by the python package.
Signed-off-by Bernd Kuhls <[email protected]>
Thanks for those patches. However, I don't quite understand how it was working in Python 3.10.
I agree that in Python 3.11, they moved some detection logic from setup.py to configure.ac. But the actual code of dbm module hasn't changed. Back in Python 3.10, it was already calling dbm_open(), which gets expanded by a macro from db.h into __db_ndbm_open(). And indeed in Python 3.10, the dbm module already has references to this symbol:
$ readelf -aW output/target/usr/lib/python3.10/lib-dynload/_dbm.cpython-310-arm-linux-gnueabihf.so | grep "UND.*__db"
10: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_delete
15: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_store
23: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_nextkey
25: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_clearerr
40: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_fetch
41: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_open
44: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_firstkey
48: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_error
51: 00000000 0 NOTYPE GLOBAL DEFAULT UND __db_ndbm_closeAnd those symbols are not provided by libdb-5.3.so:
$ readelf -aW output/target/usr/lib/libdb-5.3.so | grep __db_ndbm $
But, the dbm Python module works as expected:
# python Python 3.10.8 (main, Aug 7 2023, 22:52:15) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
import dbm
dbm.open("/tmp/plop", "c")
<dbm.dumb._Database object at 0x767ccc28>
So I'm really confused. How does it work in Python 3.10 ? Did we already need the historic dbm interface back then ?
Any idea?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
A message that is not in the archive (sent off-list or not yet received): 20230807231438.6bfe2c7a__31533.8530390122$1691442911$gmane$org@windsurf
Hi,
Am Mon, 7 Aug 2023 23:14:38 +0200 schrieb Thomas Petazzoni via buildroot:
Quoted 3 lines
I agree that in Python 3.11, they moved some detection logic from
setup.pyto configure.ac. But the actual code of dbm module hasn't changed.
the problem I am fixing is only about the detection during configure and unrelated to the code of the dbm module.
The detection logic in Python 3.11 tries to link a sample program containing "dbm_open()" to -ldb: https://github.com/python/cpython/blob/
d2340ef25721b6a72d45d4508c672c4be38c67d3/configure.ac#L4007
and fails, for whatever reason:
conftest.c:(.text.startup+0x8): undefined reference to `__db_ndbm_open'
The detection in Python 3.10 is aimed only at the existence of the library file and does not try to link code: https://github.com/python/cpython/
blob/b4e48a444ea02921ce4b701fe165e6cfd4cf5845/setup.py#L1430C34-L1430C65
Quoted 2 lines
So I'm really confused. How does it work in Python 3.10 ? Did we already need the historic dbm interface back then ?
Me, too, but only because my knowledge about C functions, macro expansion etc. is very limited, I can not comment your analysis why the dbm module works despite missing symbols. Anyway, with Python 3.11 the dbm module is not build at all atm.
Regards, Bernd
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello,
Quoted 2 lines · On Tue, 08 Aug 2023 18:01:40 +0200 Bernd Kuhls <[email protected]> wrote:
the problem I am fixing is only about the detection during configure and unrelated to the code of the dbm module.
I understand, but it raises additional questions.
Quoted 6 lines
The detection logic in Python 3.11 tries to link a sample program containing "
dbm_open()" to -ldb: https://github.com/python/cpython/blob/
d2340ef25721b6a72d45d4508c672c4be38c67d3/configure.ac#L4007and fails, for whatever reason:
conftest.c:(.text.startup+0x8): undefined reference to `__db_ndbm_open'
Absolutely, this is understood.
Quoted 3 lines
The detection in Python 3.10 is aimed only at the existence of the library file and does not try to link code: https://github.com/python/cpython/
blob/b4e48a444ea02921ce4b701fe165e6cfd4cf5845/setup.py#L1430C34-L1430C65
Correct.
Quoted 7 lines
Quoted 2 lines
So I'm really confused. How does it work in Python 3.10 ? Did we already need the historic dbm interface back then ?
Me, too, but only because my knowledge about C functions, macro expansion etc. is very limited, I can not comment your analysis why the dbm module works despite missing symbols. Anyway, with Python 3.11 the dbm module is not build at all atm.
Yes, I understand that, but rather than "blindly" fixing the issue, I'd like to understand what is happening. Indeed, as I explained in previous e-mail, the dbm module in Python 3.10 is *already* using __db_ndbm_open(), which isn't provided by libdb-5.3.so, so I'm really confused on how it can work today. Perhaps we have an existing issue in Python 3.10, and your change needs to also be backported to our maintenance branch? This is why understand what's happening is important.
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Bernd" == Bernd Kuhls <[email protected]> writes:
Berkeley DB support in python depends on dbm, when missing python fails to detect libdb:
https://github.com/python/cpython/blob/d2340ef25721b6a72d45d4508c672c4be38c67d3/configure.ac#L4002quoting python configure log:
checking for libdb... no
Quoted 7 lines
quoting python config.log:
conftest.c:(.text.startup+0x8): undefined reference to `__db_ndbm_open'This patch provides a configure option for the historic dbm interface to be used by the python package.
Signed-off-by Bernd Kuhls <[email protected]>
Committed to 2023.02.x and 2023.05.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot