Building FTS3 as loadable extension
(1) By Karl Bartel (karl42) on 2021-12-19 12:05:33 [link] [source]
I'm trying to build FTS3 as loadable extension with the following steps
mkdir bld
cd bld
../configure
make .target_source
tclsh ../ext/fts3/mkfts3amal.tcl
gcc -g -fPIC -shared fts3amal.c -o fts3.so
which gives me the following error:
fts3amal.c:302:10: fatal error: fts3Int.h: No such file or directory
302 | #include "fts3Int.h"
| ^~~~~~~~~~~
compilation terminated.
At a first glance, mkfts3amal.tcl
seems to be missing some of the required files (both headers and C files). Is the script outdated, or am I doing something else wrong?
The following patch makes the compilation work: ```diff diff --git a/ext/fts3/mkfts3amal.tcl b/ext/fts3/mkfts3amal.tcl index 059048717..18bdd013c 100644 --- a/ext/fts3/mkfts3amal.tcl +++ b/ext/fts3/mkfts3amal.tcl @@ -40,6 +40,7 @@ puts $out [subst # text of the file in-line. The file only needs to be included once. # foreach hdr {
- fts3Int.h fts3.h fts3_hash.h fts3_tokenizer.h @@ -104,10 +105,18 @@ proc copy_file {filename} { # foreach file { fts3.c
- fts3_aux.c
- fts3_expr.c
- fts3_write.c
- fts3_snippet.c fts3_hash.c fts3_porter.c fts3_tokenizer.c fts3_tokenizer1.c
- fts3_icu.c
- fts3_tokenize_vtab.c
- fts3_unicode2.c
- fts3_unicode.c } { copy_file tsrc/$file } ```
But trying the result with echo '.load ./fts3' | sqlite3
still gives me an error.
Error: ./fts3.so: undefined symbol: sqlite3FtsUnicodeIsdiacritic
Before investigating further, I would like to know if I'm on the right path or missing something important.
Thanks in advance,
Karl
(2) By Dan Kennedy (dan) on 2021-12-20 11:17:38 in reply to 1 [link] [source]
Is the script outdated, or am I doing something else wrong?
Looks like that script was added in 2008 but never used. Instead, the main amalgamation includes fts3 files directly.
If you need to build fts3 this way, it might be easier to adapt the fts5 script in ext/fts5/tool/mkfts5c.tcl. Or, better yet, just use fts5 instead.
Dan.
(3) By Karl Bartel (karl42) on 2021-12-20 16:50:14 in reply to 2 [source]
Thanks for your feedback! My plan was to get an ICU enabled FTS3 module which I can load from the sqlite in python's stdlib to get access to the ICU tokenizer. The ICU tokenizer is not available in FTS5, so that would not help.
I will probably just continue using the unicode tokenizer which seems to work well enough.
My suggestion would be to remove mkfts3amal.tcl
if there are not plans to update it.