やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

Pi4B Raspbian buster 最新SQLite3のビルド&インストール

 ICUがインストールできなかった……。

準備

ICUのインストール

$ sudo apt search icu | grep icu

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

icinga2-classicui/stable,stable 2.10.3-2 all
icu-devtools/stable,stable 63.1-6 armhf
icu-doc/stable,stable 63.1-6 all
identicurse/stable,stable 0.9+dfsg0-1 all
libbasicusageenvironment1/stable,stable,now 2018.11.26-1.1 armhf [インストール済み、自動]
  implementation of difficult monads made easy with operational semantics
  implementation of difficult monads made easy with operational semantics; documentation
  implementation of difficult monads made easy with operational semantics; profiling libraries
libghc-text-icu-dev/stable,stable 0.7.0.1-12+b1 armhf
libghc-text-icu-doc/stable,stable 0.7.0.1-12 all
libghc-text-icu-prof/stable,stable 0.7.0.1-12+b1 armhf
libharfbuzz-icu0/stable,stable,now 2.3.1-1 armhf [インストール済み、自動]
libicu-dev/stable,stable 63.1-6 armhf
libicu-le-hb-dev/stable,stable 1.0.3+git180724-3 armhf
libicu-le-hb0/stable,stable 1.0.3+git180724-3 armhf
libicu4j-4.2-java/stable,stable 4.2.1.1-6 all
libicu4j-4.4-java/stable,stable 4.4.2.2-3 all
libicu4j-49-java/stable,stable 49.1-3 all
libicu4j-java/stable,stable,now 62.1-2 all [インストール済み、自動]
libicu4j-java-doc/stable,stable 62.1-2 all
libicu63/stable,stable,now 63.1-6 armhf [インストール済み、自動]
  Java library to instantiate a new object of a particular class
  ridiculous space shooter governed by the laws of gravity
  ridiculous space shooter governed by the laws of gravity -- data
php-symfony-polyfill-intl-icu/stable,stable 1.9.0-1 all
ploticus-doc/stable,stable 2.41-2 all
  Documentation and gallery of examples for ploticus
  scientific tool for perpendicular line scanning FCS
python-pyicu/stable,stable 2.2-2 armhf
python-pyicu-dbg/stable,stable 2.2-2 armhf
python3-icu/stable,stable 2.2-2 armhf
python3-icu-dbg/stable,stable 2.2-2 armhf
r-cran-reticulate/stable,stable 1.10+dfsg-1 armhf
  run a command at a particular time
yaz-icu/stable,stable 5.27.1-2 armhf

 開発版devをインストールする。

sudo apt -y install icu-devtools
sudo apt -y install libicu-dev

 確認。だが、なぜかインストールされていない……。

$ icu-config
bash: icu-config: コマンドが見つかりません

icuinfoならあった。でも欲しいのはicu-config

$ icuinfo
 <icuSystemParams type="icu4c">
    <param name="copyright"> Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html </param>
    <param name="product">icu4c</param>
    <param name="product.full">International Components for Unicode for C/C++</param>
    <param name="version">63.1</param>
    <param name="version.unicode">11.0</param>
    <param name="platform.number">4000</param>
    <param name="platform.type">Linux</param>
    <param name="locale.default">ja_JP</param>
    <param name="locale.default.bcp47">ja-JP</param>
    <param name="converter.default">UTF-8</param>
    <param name="icudata.name">icudt63l</param>
    <param name="icudata.path"></param>
    <param name="cldr.version">34.0</param>
    <param name="tz.version">2018e</param>
    <param name="tz.default">Asia/Tokyo</param>
    <param name="cpu.bits">32</param>
    <param name="cpu.big_endian">0</param>
    <param name="os.wchar_width">4</param>
    <param name="os.charset_family">0</param>
    <param name="os.host">arm-unknown-linux-gnueabihf</param>
    <param name="build.build">arm-unknown-linux-gnueabihf</param>
    <param name="build.cc">gcc</param>
    <param name="build.cxx">g++</param>
    <param name="uconfig.internal_digitlist">1</param>
    <param name="uconfig.have_parseallinput">1</param>
 </icuSystemParams>


ICU Initialization returned: U_ZERO_ERROR
Plugins are disabled.

ダウンロード

 最新ソースを探してダウンロード&展開。

wget https://www.sqlite.org/2019/sqlite-src-3300100.zip
unzip sqlite-src-3300100.zip

 2.コマンドラインインターフェイスのコンパイルによると、合併(amalgamation)にある以下ソースファイルも必要らしい。(SQLITE_ENABLE_UPDATE_DELETE_LIMITなど一部のビルドオプションを有効にする場合)

  • sqlite3.c
  • sqlite3.h
  • shell.c
wget https://www.sqlite.org/2019/sqlite-autoconf-3300100.tar.gz
tar xf sqlite-autoconf-3300100.tar.gz
cp ./sqlite-autoconf-3300100/sqlite3.c ./sqlite-src-3300100/sqlite3.c
cp ./sqlite-autoconf-3300100/sqlite3.h ./sqlite-src-3300100/sqlite3.h
cp ./sqlite-autoconf-3300100/shell.c ./sqlite-src-3300100/shell.c
cd ./sqlite-src-3300100

configure

ヘルプ

$ ./configure --help

ログ

`configure' configures sqlite 3.30.1 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/sqlite]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-shared[=PKGS]  build shared libraries [default=yes]
  --enable-static[=PKGS]  build static libraries [default=yes]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --disable-largefile     omit support for large files
  --disable-threadsafe    Disable mutexing
  --enable-releasemode    Support libtool link to release mode
  --enable-tempstore      Use an in-ram database for temporary tables
                          (never,no,yes,always)
  --disable-tcl           do not build TCL extension
  --enable-editline       enable BSD editline support
  --disable-readline      disable readline support
  --enable-debug          enable debugging & verbose explain
  --disable-amalgamation  Disable the amalgamation and instead build all files
                          separately
  --disable-load-extension
                          Disable loading of external extensions
  --enable-memsys5        Enable MEMSYS5
  --enable-memsys3        Enable MEMSYS3
  --enable-fts3           Enable the FTS3 extension
  --enable-fts4           Enable the FTS4 extension
  --enable-fts5           Enable the FTS5 extension
  --enable-json1          Enable the JSON1 extension
  --enable-update-limit   Enable the UPDATE/DELETE LIMIT clause
  --enable-geopoly        Enable the GEOPOLY extension
  --enable-rtree          Enable the RTREE extension
  --enable-session        Enable the SESSION extension
  --enable-gcov           Enable coverage testing using gcov

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-pic              try to use only PIC/non-PIC objects [default=use
                          both]
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-tcl=DIR          directory containing tcl configuration
                          (tclConfig.sh)
  --with-readline-lib     specify readline library
  --with-readline-inc     specify readline include paths

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  TCLLIBDIR   Where to install tcl plugin

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to the package provider.

実行

 本当は以下のようにしたかった。

time ./configure \
--enable-fts4 \
--enable-fts5 \
--enable-json1 \
--enable-update-limit \
--enable-geopoly \
--enable-rtree \
--enable-session \
LIBS="-lz" \
LDFLAGS="`icu-config --ldflags`" \
CFLAGS="`icu-config --cppflags` -DHAVE_READLINE=1 -DSQLITE_ALLOW_URI_AUTHORITY=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_ICU=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_USE_ALLOCA=1 -DSQLITE_USE_FCNTL_TRACE=1 -DSQLITE_HAVE_ZLIB=1"

すぐにicu-config: コマンドが見つかりませんと怒られる。

bash: icu-config: コマンドが見つかりません
bash: icu-config: コマンドが見つかりません
checking build system type... armv7l-unknown-linux-gnueabihf
checking host system type... armv7l-unknown-linux-gnueabihf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for intptr_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uintptr_t... yes
checking for sys/types.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for stdint.h... (cached) yes
checking for inttypes.h... (cached) yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking for fdatasync... yes
checking for gmtime_r... yes
checking for isnan... yes
checking for localtime_r... yes
checking for localtime_s... no
checking for malloc_usable_size... yes
checking for strchrnul... yes
checking for usleep... yes
checking for utime... yes
checking for pread... yes
checking for pread64... yes
checking for pwrite... yes
checking for pwrite64... yes
checking for tclsh8.7... no
checking for tclsh8.6... tclsh8.6
configure: Version set to 3.30
configure: Release set to 3.30.1
configure: Version number set to 3030001
checking whether to support threadsafe operation... yes
checking for library containing pthread_create... -lpthread
checking for library containing pthread_mutexattr_init... none required
checking whether to support shared library linked as release mode or not... no
checking whether to use an in-ram database for temporary tables... no
checking if executables have the .exe suffix... unknown
checking for Tcl configuration... found /usr/lib/tclConfig.sh
checking for existence of /usr/lib/tclConfig.sh... loading
checking for library containing readline... no
checking for library containing tgetent... -lncurses
checking for readline in -lreadline... yes
checking readline.h usability... no
checking readline.h presence... no
checking for readline.h... no
checking for /usr/include/readline.h... no
checking for /usr/include/readline/readline.h... yes
checking for library containing fdatasync... none required
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for library containing deflate... none required
checking for library containing dlopen... -ldl
checking whether to support MEMSYS5... no
checking whether to support MEMSYS3... no
checking for library containing log... -lm
checking for library containing log... (cached) -lm
configure: creating ./config.status
config.status: creating Makefile
config.status: creating sqlite3.pc
config.status: creating config.h
config.status: executing libtool commands

real    0m20.886s
user    0m10.993s
sys 0m7.507s

 仕方ないのでICUは諦めた。以下コマンドにする。

time ./configure \
--enable-fts4 \
--enable-fts5 \
--enable-json1 \
--enable-update-limit \
--enable-geopoly \
--enable-rtree \
--enable-session \
LIBS="-lz" \
CFLAGS="-DHAVE_READLINE=1 -DSQLITE_ALLOW_URI_AUTHORITY=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_USE_ALLOCA=1 -DSQLITE_USE_FCNTL_TRACE=1 -DSQLITE_HAVE_ZLIB=1"
...
real    0m17.244s
user    0m11.049s
sys 0m6.922s

 ビルド。

time make

ログ

./libtool --mode=link gcc -DHAVE_READLINE=1 -DSQLITE_ALLOW_URI_AUTHORITY=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_USE_ALLOCA=1 -DSQLITE_USE_FCNTL_TRACE=1 -DSQLITE_HAVE_ZLIB=1 -DSQLITE_OS_UNIX=1 -I. -I/tmp/work/sqlite-src-3300100/src -I/tmp/work/sqlite-src-3300100/ext/rtree -I/tmp/work/sqlite-src-3300100/ext/icu -I/tmp/work/sqlite-src-3300100/ext/fts3 -I/tmp/work/sqlite-src-3300100/ext/async -I/tmp/work/sqlite-src-3300100/ext/session -I/tmp/work/sqlite-src-3300100/ext/userauth -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/include/tcl8.6 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1  -DSQLITE_HAVE_ZLIB=1    -DHAVE_READLINE=1 -I/usr/include/readline -DHAVE_EDITLINE=0 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_DESERIALIZE -o sqlite3 \
    shell.c sqlite3.c \
    -lreadline -lncurses  -lm -lm -ldl -lpthread -lz  -rpath "/usr/local/lib"
libtool: link: gcc -DHAVE_READLINE=1 -DSQLITE_ALLOW_URI_AUTHORITY=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_USE_ALLOCA=1 -DSQLITE_USE_FCNTL_TRACE=1 -DSQLITE_HAVE_ZLIB=1 -DSQLITE_OS_UNIX=1 -I. -I/tmp/work/sqlite-src-3300100/src -I/tmp/work/sqlite-src-3300100/ext/rtree -I/tmp/work/sqlite-src-3300100/ext/icu -I/tmp/work/sqlite-src-3300100/ext/fts3 -I/tmp/work/sqlite-src-3300100/ext/async -I/tmp/work/sqlite-src-3300100/ext/session -I/tmp/work/sqlite-src-3300100/ext/userauth -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/include/tcl8.6 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_HAVE_ZLIB=1 -DHAVE_READLINE=1 -I/usr/include/readline -DHAVE_EDITLINE=0 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_DESERIALIZE -o sqlite3 shell.c sqlite3.c  -lreadline -lncurses -lm -ldl -lpthread -lz -Wl,-rpath -Wl,/usr/local/lib
./libtool --mode=compile --tag=CC gcc -DHAVE_READLINE=1 -DSQLITE_ALLOW_URI_AUTHORITY=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_USE_ALLOCA=1 -DSQLITE_USE_FCNTL_TRACE=1 -DSQLITE_HAVE_ZLIB=1 -DSQLITE_OS_UNIX=1 -I. -I/tmp/work/sqlite-src-3300100/src -I/tmp/work/sqlite-src-3300100/ext/rtree -I/tmp/work/sqlite-src-3300100/ext/icu -I/tmp/work/sqlite-src-3300100/ext/fts3 -I/tmp/work/sqlite-src-3300100/ext/async -I/tmp/work/sqlite-src-3300100/ext/session -I/tmp/work/sqlite-src-3300100/ext/userauth -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/include/tcl8.6 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1  -DSQLITE_HAVE_ZLIB=1  -DUSE_TCL_STUBS=1 -c /tmp/work/sqlite-src-3300100/src/tclsqlite.c
libtool: compile:  gcc -DHAVE_READLINE=1 -DSQLITE_ALLOW_URI_AUTHORITY=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_USE_ALLOCA=1 -DSQLITE_USE_FCNTL_TRACE=1 -DSQLITE_HAVE_ZLIB=1 -DSQLITE_OS_UNIX=1 -I. -I/tmp/work/sqlite-src-3300100/src -I/tmp/work/sqlite-src-3300100/ext/rtree -I/tmp/work/sqlite-src-3300100/ext/icu -I/tmp/work/sqlite-src-3300100/ext/fts3 -I/tmp/work/sqlite-src-3300100/ext/async -I/tmp/work/sqlite-src-3300100/ext/session -I/tmp/work/sqlite-src-3300100/ext/userauth -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/include/tcl8.6 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_HAVE_ZLIB=1 -DUSE_TCL_STUBS=1 -c /tmp/work/sqlite-src-3300100/src/tclsqlite.c  -fPIC -DPIC -o .libs/tclsqlite.o
/tmp/work/sqlite-src-3300100/src/tclsqlite.c: In function ‘DbTraceV2Handler’:
/tmp/work/sqlite-src-3300100/src/tclsqlite.c:657:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                                Tcl_NewWideIntObj((Tcl_WideInt)pStmt));
                                                  ^
/tmp/work/sqlite-src-3300100/src/tclsqlite.c:672:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                                Tcl_NewWideIntObj((Tcl_WideInt)pStmt));
                                                  ^
/tmp/work/sqlite-src-3300100/src/tclsqlite.c:686:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                                Tcl_NewWideIntObj((Tcl_WideInt)pStmt));
                                                  ^
/tmp/work/sqlite-src-3300100/src/tclsqlite.c:698:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                                Tcl_NewWideIntObj((Tcl_WideInt)db));
                                                  ^
libtool: compile:  gcc -DHAVE_READLINE=1 -DSQLITE_ALLOW_URI_AUTHORITY=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_USE_ALLOCA=1 -DSQLITE_USE_FCNTL_TRACE=1 -DSQLITE_HAVE_ZLIB=1 -DSQLITE_OS_UNIX=1 -I. -I/tmp/work/sqlite-src-3300100/src -I/tmp/work/sqlite-src-3300100/ext/rtree -I/tmp/work/sqlite-src-3300100/ext/icu -I/tmp/work/sqlite-src-3300100/ext/fts3 -I/tmp/work/sqlite-src-3300100/ext/async -I/tmp/work/sqlite-src-3300100/ext/session -I/tmp/work/sqlite-src-3300100/ext/userauth -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/include/tcl8.6 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_HAVE_ZLIB=1 -DUSE_TCL_STUBS=1 -c /tmp/work/sqlite-src-3300100/src/tclsqlite.c -o tclsqlite.o >/dev/null 2>&1
./libtool --mode=link gcc -DHAVE_READLINE=1 -DSQLITE_ALLOW_URI_AUTHORITY=1 -DSQLITE_INTROSPECTION_PRAGMAS=1 -DSQLITE_USE_ALLOCA=1 -DSQLITE_USE_FCNTL_TRACE=1 -DSQLITE_HAVE_ZLIB=1 -DSQLITE_OS_UNIX=1 -I. -I/tmp/work/sqlite-src-3300100/src -I/tmp/work/sqlite-src-3300100/ext/rtree -I/tmp/work/sqlite-src-3300100/ext/icu -I/tmp/work/sqlite-src-3300100/ext/fts3 -I/tmp/work/sqlite-src-3300100/ext/async -I/tmp/work/sqlite-src-3300100/ext/session -I/tmp/work/sqlite-src-3300100/ext/userauth -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -I/usr/include/tcl8.6 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_MEMSYS3=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_ENABLE_SNAPSHOT=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1  -DSQLITE_HAVE_ZLIB=1    -no-undefined -o libtclsqlite3.la tclsqlite.lo \
    libsqlite3.la -L/usr/lib/arm-linux-gnueabihf -ltclstub8.6 -lm -lm -ldl -lpthread -lz  \
    -rpath "/usr/share/tcltk/tcl8.6/sqlite3" \
    -version-info "8:6:8" \
    -avoid-version
libtool: link: gcc -shared  .libs/tclsqlite.o   -Wl,-rpath -Wl,/tmp/work/sqlite-src-3300100/.libs ./.libs/libsqlite3.so -L/usr/lib/arm-linux-gnueabihf -ltclstub8.6 -lm -ldl -lpthread -lz    -Wl,-soname -Wl,libtclsqlite3.so -o .libs/libtclsqlite3.so
libtool: link: ar cru .libs/libtclsqlite3.a  tclsqlite.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libtclsqlite3.a
libtool: link: ( cd ".libs" && rm -f "libtclsqlite3.la" && ln -s "../libtclsqlite3.la" "libtclsqlite3.la" )

real  0m24.807s
user  0m22.955s
sys   0m1.661s

確認

./sqlite3 --version
3.30.1 2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b
./sqlite3 :memory: "pragma compile_options;"
ALLOW_URI_AUTHORITY
COMPILER=gcc-8.3.0
ENABLE_COLUMN_METADATA
ENABLE_DBSTAT_VTAB
ENABLE_FTS4
ENABLE_FTS5
ENABLE_GEOPOLY
ENABLE_JSON1
ENABLE_MEMSYS3
ENABLE_PREUPDATE_HOOK
ENABLE_RTREE
ENABLE_SESSION
ENABLE_SNAPSHOT
ENABLE_STMTVTAB
ENABLE_UNKNOWN_SQL_FUNCTION
ENABLE_UNLOCK_NOTIFY
ENABLE_UPDATE_DELETE_LIMIT
HAVE_ISNAN
THREADSAFE=1
USE_ALLOCA
USE_FCNTL_TRACE

モジュール、プラグマ、関数

モジュール

./sqlite3 :memory: "pragma module_list;" | sort
completion
dbstat
fsdir
fts3
fts3tokenize
fts4
fts4aux
fts5
fts5vocab
geopoly
json_each
json_tree
rtree
rtree_i32
sqlite_dbdata
sqlite_dbpage
sqlite_dbptr
sqlite_stmt
zipfile

プラグマ

./sqlite3 :memory: "pragma pragma_list;"
-- Loading resources from /home/pi/.sqliterc
application_id
auto_vacuum
automatic_index
busy_timeout
cache_size
cache_spill
case_sensitive_like
cell_size_check
checkpoint_fullfsync
collation_list
compile_options
count_changes
data_version
database_list
default_cache_size
defer_foreign_keys
empty_result_callbacks
encoding
foreign_key_check
foreign_key_list
foreign_keys
freelist_count
full_column_names
fullfsync
function_list
ignore_check_constraints
incremental_vacuum
index_info
index_list
index_xinfo
integrity_check
journal_mode
journal_size_limit
legacy_alter_table
legacy_file_format
locking_mode
max_page_count
mmap_size
module_list
optimize
page_count
page_size
pragma_list
query_only
quick_check
read_uncommitted
recursive_triggers
reverse_unordered_selects
schema_version
secure_delete
short_column_names
shrink_memory
soft_heap_limit
synchronous
table_info
table_xinfo
temp_store
temp_store_directory
threads
user_version
wal_autocheckpoint
wal_checkpoint
writable_schema

関数

./sqlite3 :memory: "pragma function_list;" | sort
abs|1
avg|1
bm25|0
changes|1
char|1
coalesce|1
count|1
cume_dist|1
current_date|1
current_timestamp|1
current_time|1
datetime|1
date|1
dense_rank|1
edit|0
first_value|1
fts3_tokenizer|0
fts5_decode_none|0
fts5_decode|0
fts5_expr_tcl|0
fts5_expr|0
fts5_fold|0
fts5_isalnum|0
fts5_rowid|0
fts5_source_id|0
fts5|0
geopoly_area|0
geopoly_bbox|0
geopoly_blob|0
geopoly_ccw|0
geopoly_contains_point|0
geopoly_debug|0
geopoly_group_bbox|0
geopoly_json|0
geopoly_overlap|0
geopoly_regular|0
geopoly_svg|0
geopoly_within|0
geopoly_xform|0
glob|1
group_concat|1
hex|1
highlight|0
ifnull|1
instr|1
json_array_length|0
json_array|0
json_extract|0
json_group_array|0
json_group_object|0
json_insert|0
json_object|0
json_patch|0
json_quote|0
json_remove|0
json_replace|0
json_set|0
json_type|0
json_valid|0
json|0
julianday|1
lag|1
last_insert_rowid|1
last_value|1
lead|1
length|1
likelihood|1
likely|1
like|1
load_extension|1
lower|1
lsmode|0
ltrim|1
matchinfo|0
match|0
max|1
min|1
nth_value|1
ntile|1
nullif|1
offsets|0
optimize|0
percent_rank|1
printf|1
quote|1
randomblob|1
random|1
rank|1
readfile|0
replace|1
round|1
row_number|1
rtreecheck|0
rtreedepth|0
rtreenode|0
rtrim|1
sha3_query|0
sha3|0
shell_add_schema|0
shell_escape_crnl|0
shell_idquote|0
shell_int32|0
shell_module_schema|0
shell_putsnl|0
snippet|0
sqlar_compress|0
sqlar_uncompress|0
sqlite_compileoption_get|1
sqlite_compileoption_used|1
sqlite_log|1
sqlite_offset|1
sqlite_source_id|1
sqlite_version|1
strftime|1
substr|1
sum|1
time|1
total_changes|1
total|1
trim|1
typeof|1
unicode|1
unknown|1
unlikely|1
upper|1
writefile|0
zeroblob|1
zipfile_cds|0
zipfile|0

配置

ln ./sqlite3 ~/some/sqlite3

 異なるビルドオプションの実行ファイルを複数つくるかもしれないのでmake installはしていない。手動で任意に配置する。

前回まで

 ハード。

 ソフト。

 設定。

 データ移行。

 セキュリティ。

 企業。