SQLite Forum

Building a DIY libsqlite3.so

Building a DIY libsqlite3.so

(1) By anonymous on 2021-02-26 07:03:36 [link] [source]

I've got the source code (snapshot 202101022356) and build SQLite3 v.35.

Now I want to build a new shared library (with and without debug information). Is there a procedure I should follow?

(2.1) By Warren Young (wyoung) on 2021-02-26 07:10:23 edited from 2.0 in reply to 1 [source]

The docs?

(First result from a web search for "build sqlite", by the way.)

(3) By anonymous on 2021-02-26 07:43:24 in reply to 2.1 [link] [source]

That is the one I found. Unfortunately,I ran into a snag.

shell.c:122:11: fatal error: readline/readline.h: No such file or directory

The directory is not in snapshot. Oopsie?

(4) By Warren Young (wyoung) on 2021-02-26 07:52:50 in reply to 3 [link] [source]

The end of section 2 of that doc covers readline.

(5) By anonymous on 2021-02-26 08:04:49 in reply to 4 [link] [source]

Thisd line Add -DHAVE_READLINE and the -lreadline and -lncurses libraries to get command-line editing support. That's exactly what I want. So I used this command:


Seems to me, that I checked all the boxes.

(6) By Larry Brasfield (larrybr) on 2021-02-26 10:00:34 in reply to 5 [link] [source]

When you #define HAVE_READLINE, you should have the readline library. On Ubuntu, installing the package libreadline-dev suffices.

(7) By anonymous on 2021-02-26 10:30:09 in reply to 6 [link] [source]

Thank you. I wasn't sure if that was the correct library because I ended up for this:

/usr/bin/ld: /tmp/ccYRFinB.o: in function `fts5Bm25Function':
sqlite3.c:(.text+0x3486f): undefined reference to `log'
collect2: error: ld returned 1 exit status

I am sorry that I am doing this step by step, but I want to be sure I didn't miss something that is important

(8) By Warren Young (wyoung) on 2021-02-26 10:45:15 in reply to 7 [link] [source]

Add -lm to the end of the build command.

(9) By anonymous on 2021-02-26 12:03:05 in reply to 8 [link] [source]

Success!!! After a small victory dance I set down to check the version of the fresh compiled lib. You've probably guessed it — dramatic pause — v3.33.0. 

It's a déjà vu… (and a Freudian race condition of several anxieties.)