On Tue, 20 Dec 2022 12:18:59 -0000 (UTC) Stuart Henderson <[email protected]> wrote:
> ["Followup-To:" header set to gmane.os.openbsd.misc.] > On 2022-12-19, Stuart Cassoff <[email protected]> wrote: > > ------ Original Message ------ > > From: [email protected] > > To: [email protected] > > Cc: [email protected] > > Sent: Monday, December 19, 2022 7:53 AM > > Subject: Re: Python access to Berkeley DB > > > > [ moving to ports@, hopefully reply-to will be set correctly > > if > > I got the gmane/nntp bits right :) ] > > > > You might possibly be able to kludge around it with some LD_PRELOAD, > > though tkinter is now built against Tcl 8.6 and the db-tcl package is > > built against Tcl 8.5 and I don't know if extensions are compatible > > cross-version. > > > > > > Extensions built against 8.5 should load into 8.6 no problem. > > Thanks. I wasn't sure and the tclsh import didn't work for either 8.5 or 8.6 > for me. > > Thanks for LD_PRELOAD, about which I knew nothing. The kludge got rid of all but one undefined symbols: Script started on Tue Dec 20 09:20:33 2022 d630amd64$ ls /usr/local/lib/db4 libdb.a libdb_cxx.a libdb_tcl.a pkgIndex.tcl libdb.la libdb_cxx.la libdb_tcl.la libdb.so.5.0 libdb_cxx.so.6.0 libdb_tcl.so.6.0 d630amd64$ export LD_PRELOAD=/usr/local/lib/db4/libdb_tcl.so.6.0 d630amd64$ python3.9 Python 3.9.15 (main, Oct 21 2022, 14:01:40) [Clang 13.0.0 ] on openbsd7 Type "help", "copyright", "credits" or "license" for more information. >>> import tkinter >>> tcl = tkinter.Tk(useTk=False) >>> tcl.tk.call("lappend", "auto_path", "/usr/local/lib/db4") (<path object: '/usr/local/lib/tcl/tcl8.6'>, '/usr/local/lib/tcl', '/usr/local/lib/db4') >>> tcl.tk.call("package", "require", "Db_tcl") python3.9:/usr/local/lib/db4/libdb_tcl.so.6.0: undefined symbol 'Tcl_PkgProvideEx' ld.so: python3.9: lazy binding failed! Killed d630amd64$ exit Script done on Tue Dec 20 09:24:01 2022 so I tried building from ports, building Python against Tcl/Tk 8.5 because I could see what to change in Makefile.inc with some confidence I was guessing right (8.6 > 8.5 about line 100). Same result, first with package command: Script started on Tue Dec 20 20:25:17 2022 rack$ export LD_PRELOAD=/usr/local/lib/db4/libdb_tcl.so.6.0 rack$ python3.9 Python 3.9.14 (main, Dec 20 2022, 16:12:25) [Clang 13.0.0 ] on openbsd7 Type "help", "copyright", "credits" or "license" for more information. >>> import tkinter >>> tkinter.TclVersion 8.5 >>> tcl = tkinter.Tk(useTk=False) >>> tcl.tk.call("lappend", "auto_path", "/usr/local/lib/db4") (<path object: '/usr/local/lib/tcl/tcl8.5'>, '/usr/local/lib/tcl', '/usr/local/lib/db4') >>> tcl.tk.call("package", "require", "Db_tcl") python3.9:/usr/local/lib/db4/libdb_tcl.so.6.0: undefined symbol 'Tcl_PkgProvideEx' ld.so: python3.9: lazy binding failed! Killed rack$ tclsh8.5 % lappend auto_path /usr/local/lib/db4 /usr/local/lib/tcl/tcl8.5 /usr/local/lib/tcl /usr/local/lib/db4 % package require Db_tcl 4.6 % exit rack$ exit Script done on Tue Dec 20 20:33:19 2022 And with the load command: Script started on Wed Dec 21 20:25:22 2022 rack$ tclsh8.5 % load /usr/local/lib/db4/libdb_tcl.so.6.0 % berkdb version -string Berkeley DB 4.6.21: (September 27, 2007) % exit rack$ export LD_PRELOAD=/usr/local/lib/db4/libdb_tcl.so.6.0 rack$ python3.9 Python 3.9.14 (main, Dec 20 2022, 16:12:25) [Clang 13.0.0 ] on openbsd7 Type "help", "copyright", "credits" or "license" for more information. >>> import tkinter >>> tkinter.TclVersion 8.5 >>> tcl = tkinter.Tk(useTk=False) >>> tcl.tk.call("load", "/usr/local/lib/db4/libdb_tcl.so.6.0") python3.9:/usr/local/lib/db4/libdb_tcl.so.6.0: undefined symbol 'Tcl_PkgProvideEx' ld.so: python3.9: lazy binding failed! Killed rack$ exit Script done on Wed Dec 21 20:30:35 2022 Give up on kludge I think. Roger
