pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: sqlite3 json1
>>>>> "Greg" == Greg Troxel <gdt%lexort.com@localhost> writes:
Greg> "Mathew, Cherry G.*" <c%bow.st@localhost> writes:
>> I was wondering if databases/sqlite3 builds with json1 in core
>> (this has been enabled for a while, iiuc).
Greg> I am not sure, but pkgsrc sqlite3 builds tend to include
Greg> things, while netbsd base has excluded some. This caused
Greg> issues with matrix-synapse which needed some feature.
along the same lines here - I was trying to get https://microblog.pub/
to behave.
>> Also, how does the sqlite3 in base/pkg get selected for use by a
>> program? I'm especially interested in the case of python.
Greg> databases/sqlite3/builtin.mk decides if base is good enough.
Greg> You should be able to set a PREFER variable (see the guide or
Greg> the sources; I don't have the details paged in) to force this.
Greg> A complexity is that some base libs have sqlite3 (heimdal?),
Greg> and if you force pkgsrc you can end up with it linked twice
Greg> which is bad. But you can personally avoid that more easily
Greg> than pkgsrc in the general case can avoid it.
Greg> Really, base sqlite3 should either not exist or include these
Greg> things.
My best guess is that base sqlite3 is a thing because of our fancy
apropos ?
[...]
>>>>> "Taylor" == Taylor R Campbell <campbell%mumble.net@localhost> writes:
>> From: "Mathew\, Cherry G.*" <c%bow.st@localhost> Date: Wed, 16 Aug 2023
>> 20:55:16 +0000
>>
>> I was wondering if databases/sqlite3 builds with json1 in core
>> (this has been enabled for a while, iiuc).
Taylor> $ /pkg/2023Q2/bin/sqlite3 SQLite version 3.42.0 2023-05-16
Taylor> 12:36:15 Enter ".help" for usage hints. Connected to a
Taylor> transient in-memory database. Use ".open FILENAME" to
Taylor> reopen on a persistent database.
sqlite> select '{"a":123}'->'$.a';
Taylor> 123
>> Also, how does the sqlite3 in base/pkg get selected for use by a
>> program? I'm especially interested in the case of python.
Taylor> On NetBSD, default is base, which is too old for json core
Taylor> (even in netbsd-10; time to update, I guess).
Yes please - or remove it entirely - or, have it documented (like we
have for X11 vs. Xorg) ?
Taylor> You can override this by setting PREFER_PKGSRC+=sqlite3.
Taylor> You can test which one was selected by examining `ldd
Taylor> $PREFIX/lib/python3.10/lib-dynload/_sqlite3.so', for
Taylor> example, for the py-sqlite3 package:
Taylor> $ ldd /pkg/2023Q2/lib/python3.10/lib-dynload/_sqlite3.so
Taylor> /pkg/2023Q2/lib/python3.10/lib-dynload/_sqlite3.so:
Taylor> -lsqlite3.0 => /pkg/2023Q2/lib/libsqlite3.so.0 ...
Taylor> In my case, this shows I set PREFER_PKGSRC+=sqlite3, so the
Taylor> json core expressions work:
Taylor> $ /pkg/2023Q2/bin/python3.10 Python 3.10.12 (main, Jun 26
Taylor> 2023, 19:48:34) [GCC 7.4.0] on netbsd9 Type "help",
Taylor> "copyright", "credits" or "license" for more information.
>>>> import sqlite3
>>>> sqlite3.connect(':memory:').cursor().execute('''select
>>>> '{"a":123}'->'$.a';''').fetchall()
Taylor> [('123',)]
Taylor> However, there's a complication for any packages that _also_
Taylor> link against base Heimdal, because base Heimdal is
Taylor> unconditionally linked against base sqlite3:
Taylor> <https://gnats.netbsd.org/57406>. So it's a mess that we
Taylor> need to clean up.
Taylor> P.S. FYI, I have had a much better experience with py-apsw
Taylor> than with py-sqlite3, which as I recall has hopelessly
Taylor> incoherent transaction semantics. (But the same
Taylor> PREFER_PKGSRC consideration applies.)
Thanks Taylor, Greg for your kind inputs - I am viewing this currently
with the "user" hat on, and the best thing that worked for me for now
is:
microblog_env=$microblog_env\ "LD_PRELOAD=/usr/pkg/lib/libsqlite3.so"
in my as yet uncommitted rc.d/microblog. Seems to work so far.
--
~~cherry
Home |
Main Index |
Thread Index |
Old Index