sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.
System environment:
Cent OS 7
Sqlite3 3.34.0 (Compile from source)
Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)
1. Compile sqlite3:
./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
make && make install
2. Add sqlite3 lib to lib search path:
export LD_LIBRARY_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib
export LD_RUN_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib
3. Compile Python 3.9.1
C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
make && make install
4. Test sqlite3
Python 3.9.1 (default, Jan 20 2021, 14:32:50)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
File "", line 1, in
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>>
It reports "deterministic=True requires SQLite 3.8.3 or higher", but when
execute sqlite3.sqlite_version it returns 3.34.0 which higher than 3.8.3.
Is there any advice on this issue? thanks.
--
https://mail.python.org/mailman/listinfo/python-list
Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.
HI Barry, Thanks for the suggestions, this is my output: [felix@localhost Downloads]$ gdb /home/felix/.local/python/python-3.9.1/bin/python3 GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/felix/.local/python/python-3.9.1/bin/python3.9...done. (gdb) run Starting program: /home/felix/.local/python/python-3.9.1/bin/python3 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Python 3.9.1 (default, Jan 21 2021, 02:04:50) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 >>> Program received signal SIGINT, Interrupt. 0x76a15983 in __select_nocancel () from /lib64/libc.so.6 Missing separate debuginfos, use: debuginfo-install glibc-2.17-317.el7.x86_64 ncurses-libs-5.9-14.20130511.el7_4.x86_64 nss-softokn-freebl-3.53.1-6.el7_9.x86_64 readline-6.2-11.el7.x86_64 zlib-1.2.7-18.el7.x86_64 (gdb) info shared FromTo Syms Read Shared Object Library 0x77ddbaf0 0x77df7060 Yes (*) /lib64/ld-linux-x86-64.so.2 0x778af410 0x77a7fd82 Yes /home/felix/.local/python/python-3.9.1/lib/libpython3.9.so.1.0 0x77613e30 0x77618cec Yes (*) /lib64/libcrypt.so.1 0x773fc8f0 0x77407db1 Yes (*) /lib64/libpthread.so.0 0x771f3e50 0x771f494e Yes (*) /lib64/libdl.so.2 0x76ff0e90 0x76ff17a4 Yes (*) /lib64/libutil.so.1 0x76cf3350 0x76d5e316 Yes (*) /lib64/libm.so.6 0x7693f9f0 0x76a8f9cf Yes (*) /lib64/libc.so.6 0x7671db80 0x7671e1fb Yes (*) /lib64/libfreebl3.so 0x7fffeffd50b0 0x7fffeffd6952 Yes /home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/readline.cpython-39-x86_64-linux-gnu.so 0x7fffefda0de0 0x7fffefdbf775 Yes (*) /lib64/libreadline.so.6 0x7fffefb6ee40 0x7fffefb7abb8 Yes (*) /lib64/libtinfo.so.5 0x7fffef9557c0 0x7fffef95c9b2 Yes /home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/math.cpython-39-x86_64-linux-gnu.so 0x7fffef6f4cd0 0x7fffef7080b8 Yes /home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/_datetime.cpython-39-x86_64-linux-gnu.so 0x7fffef4e8c40 0x7fffef4ebd13 Yes /home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/_heapq.cpython-39-x86_64-linux-gnu.so 0x7fffef2d7180 0x7fffef2e08ba Yes /home/felix/.local/python/python-3.9.1/lib/python3.9/lib-dynload/_sqlite3.cpython-39-x86_64-linux-gnu.so 0x7fffeefadf00 0x7fffef096c00 Yes /home/felix/.local/sqlite/default/lib/libsqlite3.so.0 0x7fffeed8b110 0x7fffeed97698 Yes (*) /lib64/libz.so.1 (*): Shared library is missing debugging information. (gdb) I created a symbol link to specific version of sqlite3 and set LD_LIBRARY_PATH: [felix@localhost sqlite]$ ll total 0 lrwxrwxrwx 1 felix felix 6 Feb 18 2020 default -> latest lrwxrwxrwx 1 felix felix 13 Jan 20 12:51 latest -> sqlite-3.34.0 drwxrwxr-x 6 felix felix 52 Feb 18 2020 sqlite-3.31.1 drwxrwxr-x 6 felix felix 52 Jan 20 12:51 sqlite-3.34.0 [felix@localhost sqlite]$ pwd /home/felix/.local/sqlite [felix@localhost sqlite]$ env | grep LD_ LD_LIBRARY_PATH=/home/felix/.local/mpfr/default/lib/:/home/felix/.local/gmp/default/lib/:/home/felix/.local/mpc/default/lib/:/home/felix/.local/sqlite/default/lib:/home/felix/.local/mysql/default/lib LD_RUN_PATH=/home/felix/.local/sqlite/default/lib 在 2021年1月21日星期四 UTC+8 上午5:53:38, 写道: > > On 20 Jan 2021, at 19:54, panfei wrote: > > > > System environment: > > > > Cent OS 7 > > Sqlite3 3.34.0 (Compile from source) > > Python 3.9.1 (Compile from source) > > Django 3.1.5 (Pip install) > > > > > > 1. Compile sqlite3: > > ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0 > > make && make install > > > > 2. Add sqlite3 lib to lib search path: > > > > export LD_LIBRARY_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib > > export LD_RUN_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/lib > > > > 3. Compile Python 3.9.1 > > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ > > CPLUS_
Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.
Hi Random: Thanks for the suggestion, I will test it right now. there is a file called sqlite3.pc in my installation. [felix@localhost pkgconfig]$ ll total 4 -rw-r--r-- 1 felix felix 315 Jan 20 12:51 sqlite3.pc [felix@localhost pkgconfig]$ pwd /home/felix/.local/sqlite/default/lib/pkgconfig 在 2021年1月21日星期四 UTC+8 上午5:57:43, 写道: > On Wed, Jan 20, 2021, at 16:45, Random832 wrote: > > On Wed, Jan 20, 2021, at 14:54, panfei wrote: > > > 3. Compile Python 3.9.1 > > > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ > > > CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ > > > LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure > > > --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations > > > make && make install > > > > How *exactly* did you compile python? i.e. what specific commands, to > > make it pick up those include paths? Because from the symptoms you are > > reporting, it sounds like it was not compiled against the correct > > version of sqlite. > Oh, sorry, I missed "./configure" on that line. > > So, it looks like you had the environment variables set when you ran > configure, but not make. I don't think this is a common way to set include > paths, by the way. The usual way is with pkg-config, but I'm not sure how to > add your .local sqlite directory to it. Does your sqlite installation include > a file called "sqlite3.pc"? If so, try adding the directory containing it to > PKG_CONFIG_PATH when running configure. > > If not... well, export the environment variables or add them when running > make and hope for the best -- https://mail.python.org/mailman/listinfo/python-list
Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.
1033 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
1034 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make
1035 make clean
1036 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
1037 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make
1038 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make install
1039 /home/felix/.local/python/python-3.9.1/bin/python3
1040 history
[felix@localhost Python-3.9.1]$
/home/felix/.local/python/python-3.9.1/bin/python3
Python 3.9.1 (default, Jan 21 2021, 10:58:50)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
>>>
Thanks very ! Every step in compilation should be with the same environment
variable. Thanks again!
在 2021年1月21日星期四 UTC+8 上午5:57:43, 写道:
> On Wed, Jan 20, 2021, at 16:45, Random832 wrote:
> > On Wed, Jan 20, 2021, at 14:54, panfei wrote:
> > > 3. Compile Python 3.9.1
> > > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> > > CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> > > LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> > > --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> > > make && make install
> >
> > How *exactly* did you compile python? i.e. what specific commands, to
> > make it pick up those include paths? Because from the symptoms you are
> > reporting, it sounds like it was not compiled against the correct
> > version of sqlite.
> Oh, sorry, I missed "./configure" on that line.
>
> So, it looks like you had the environment variables set when you ran
> configure, but not make. I don't think this is a common way to set include
> paths, by the way. The usual way is with pkg-config, but I'm not sure how to
> add your .local sqlite directory to it. Does your sqlite installation include
> a file called "sqlite3.pc"? If so, try adding the directory containing it to
> PKG_CONFIG_PATH when running configure.
>
> If not... well, export the environment variables or add them when running
> make and hope for the best
--
https://mail.python.org/mailman/listinfo/python-list
