Org-roam on emacs28.1 cant find emacsql-sqlite definition

Previously org-roam has been functioning with no problems, however after the latest update via package org-roam is having trouble finding the definition of emacsql-sqlite despite emacsql being installed.

I’ve reinstalled org-roam and emacsql to no avail. I’ve also tried using emacs 29.4, but it also does not solve the problem. The same problem also presents itself with emacs -q and following the suggestions for troubleshooting. I’m at a loss.

The backtrace when using emacs --debug-init is:

Debugger entered–Lisp error: (void-function emacsql-sqlite)
emacsql-sqlite(“~/.emacs.d/org-roam.db”)
org-roam-db()
org-roam-db-query([:select [ref nodes:file id pos title type] :from refs :left-join nodes :on (= refs:node-id nodes:id) :where (= type $s1)] “cite”)
orb-get-db-cite-refs()
orb-make-notes-cache()
org-roam-bibtex-mode()
eval-buffer(#<buffer load> nil “/home/pete/.emacs” nil t) ; Reading at buffer position 24003
load-with-code-conversion(“/home/pete/.emacs” “/home/pete/.emacs” t t)
load(“~/.emacs” noerror nomessage)
startup–load-user-init-file(#f(compiled-function () #<bytecode -0x5685283fed8bf4>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t)
command-line()
normal-top-level()

Any suggestions for next steps in troubleshooting appreciated.

I think this will help:

Thanks for responding. The versions of emacsql that i have available are:

melpa - 20241201.1551
melpa stable - 4.1.0
nongnu - 4.1.0

I have 20241201.1551 installed. Is the library version a problem here by any chance? I note that in your reply your referred to version 20241117.1614.

Ok I upgraded to a different build of emacs29.4 which was obviously compiled with the right flags and now all is good. Thanks for your help again.

2 Likes

What are these flags? I have the same problem in Devuan 5.

Are you building Emacs from source? Building with sqlite is default so no specific flag needed (that’s what have been doing; no flag for sqlite).

You may be missing the development library for sqlite3. On Ubuntu that I use, it should be something like libsqlite3-dev (or something).

I can come back with more detail from my build notes (just did this with Emacs 29.4 yesterday).

I don’t think the distribution of the Linux matters, Devuan 5 or Ubuntu.

I just do this in the terminal to build. It’s based on the INSTALL file in the source.

./autogen.sh
./configure --with-pgtk --with-native-compilation --with-tree-sitter

# Note: `--with-pgtk` is only for Wayland, which I use on my Ubuntu (default). 
# If you are using X11, remove it.

make -j$(nproc)
sudo make install

On Ubuntu, I need to have libsqlite3-dev locally. This is something you’d probably need to look up in your Devuan 5. At the end of ./configure, you will have a summary list of configuration with yes/no to indicate if a feature will be built or not. One of the items shoudl say:

Does Emacs use -lsqlite3?                               yes