SQLite Forum

How to check if HAVE_USLEEP is activated?

How to check if HAVE_USLEEP is activated?

(1) By anonymous on 2021-05-19 11:13:51 [link] [source]

Hi, I get some "database is locked" errors from Python and following https://beets.io/blog/sqlite-nightmare.html, I would like to check if HAVE_USLEEP is activated. How can I do it reliably?

"PRAGMA compile_options;" doesn't seem to do it.

I also tried to look at the Makefile generated from "./configure" but it doesn't show the "HAVE_USLEEP" flag.

(2) By Kees Nuyt (knu) on 2021-05-19 12:49:27 in reply to 1 [link] [source]

Have a look at config.h

(3) By anonymous on 2021-05-19 16:00:49 in reply to 2 [link] [source]

Have a look at config.h

Does that work? IIRC config.h is created on the system where the amalgamation is created - that is not always the machine where the amalgamation or the shell are compiled and linked. So ... one might have USLEEP and the other might not.

(4) By Kees Nuyt (knu) on 2021-05-20 03:21:25 in reply to 3 [link] [source]

In my humble opinion, any development that needs this kind of detail should not use the amalgamation, but rather a checkout of a clone of the SQLite repository.

That said, config.h can be safely removed, and recreated by running ./configure, which will fill in the platform specific details.

make sqlite.c will build the amalgamation again.

Besides, keeping a clone of the repository up to date instead of downloading the amalgamation for every release is network friendly.

(5.2) By Warren Young (wyoung) on 2021-05-20 04:06:55 edited from 5.1 in reply to 3 [source]

Autoconf-based projects avoid installing config.h by default on purpose. It's a thorny issue, solvable, but not without effort.

(6) By Keith Medcalf (kmedcalf) on 2021-05-20 05:20:08 in reply to 3 [link] [source]

If you are going to use a config.h with the amalgamation, you better make sure that you have the symbol _HAVE_SQLITE_CONFIG_H defined when the amalgamation is compiled, otherwise config.h is not included.