org-roam icon indicating copy to clipboard operation
org-roam copied to clipboard

No EmacSQL SQLite binary available, aborting

Open vonpupp opened this issue 2 years ago • 12 comments

Description

Steps to Reproduce

I am not sure if this can be reproduced or it is just an issue going on with me. I updated doom emacs and now I am not able to use emacs at all since org-roam is having problems finding emacsql-sqlite (which is there). More details can be found here

Backtrace

I am starting emacs with --debug-init since otherwise it hangs.

Debugger entered--Lisp error: (error "No EmacSQL SQLite binary available, aborting")
  signal(error ("No EmacSQL SQLite binary available, aborting"))
  error("No EmacSQL SQLite binary available, aborting")
  emacsql-sqlite-ensure-binary()
  #f(compiled-function (connection &rest rest) #<bytecode -0x10cdd35b5072a2ce>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-15763b6e7c68> (:file "~/.emacs.d.doomemacs/.local/cache/org-roam.db"))
  apply(#f(compiled-function (connection &rest rest) #<bytecode -0x10cdd35b5072a2ce>) (#<emacsql-sqlite-connection emacsql-sqlite-connection-15763b6e7c68> (:file "~/.emacs.d.doomemacs/.local/cache/org-roam.db")))
  #f(compiled-function (&rest args) #<bytecode 0x24e89310fe0bc38>)(#<emacsql-sqlite-connection emacsql-sqlite-connection-15763b6e7c68> (:file "~/.emacs.d.doomemacs/.local/cache/org-roam.db"))
  apply(#f(compiled-function (&rest args) #<bytecode 0x24e89310fe0bc38>) #<emacsql-sqlite-connection emacsql-sqlite-connection-15763b6e7c68> (:file "~/.emacs.d.doomemacs/.local/cache/org-roam.db"))
  initialize-instance(#<emacsql-sqlite-connection emacsql-sqlite-connection-15763b6e7c68> (:file "~/.emacs.d.doomemacs/.local/cache/org-roam.db"))
  #f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode -0x1694230cdd0a3921>)(emacsql-sqlite-connection :file "~/.emacs.d.doomemacs/.local/cache/org-roam.db")
  apply(#f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode -0x1694230cdd0a3921>) emacsql-sqlite-connection (:file "~/.emacs.d.doomemacs/.local/cache/org-roam.db"))
  make-instance(emacsql-sqlite-connection :file "~/.emacs.d.doomemacs/.local/cache/org-roam.db")
  emacsql-sqlite("~/.emacs.d.doomemacs/.local/cache/org-roam.db")
  org-roam-db()
  org-roam-db-sync()
  org-roam-db-autosync-mode(1)
  org-roam-setup()
  run-hooks(after-init-hook delayed-warnings-hook)
  command-line()
  normal-top-level()

Expected Results

To find the emacs-sqlite binary located in ~/.emacs.d.doomemacs/.local/straight/build-28.2/emacsql-sqlite/sqlite.

I deleted org-roam, org-roam-ui, emacs-sqlite. from build-28.2 and repos folders and doom sync afterwards to ensure a fresh pull from the repositories. The result was the same.

Actual Results

It breaks on normal start hanging badly.

Environment

Copy info below this line into issue:

  • Emacs: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6) of 2023-01-02
  • Framework: Doom
  • Org: Org mode version 9.6.1 (9.6.1-??-fe92a3ced @ /home/av/.emacs.d.doomemacs/.local/straight/build-28.2/org/)
  • Org-roam: e73807e
  • sqlite-connector: sqlite

vonpupp avatar Feb 23 '23 10:02 vonpupp

I am running into the same issue on Emacs version 28.2 as well. I think org-roam might have removed some dependencies that were added in Emacs version 29, thus breaking backwards compatibility for previous Emacs versions.

DominikMendel avatar Feb 24 '23 01:02 DominikMendel

I just updated doom emacs and apparently the issue got solved. Apparently emacsql got some updates:

    ✓ (267/341) emacsql: 4979711 -> 7c533fb [6 commit(s)] (w/ 3 dependents)
        7c533fb Rename "process" slot to "handle" and make emacsql-process obsolete
        487254a Use set-process-sentinel
        ab06045 test: Use emacsql-live-p
        f75ec0c Provide more information when failing to compile SQLite binary       <-- this might be related
        763a9e4 emacsql-fix-vector-indentation: Use nadvice
        c439978 Trigger rebuild of Melpa snapshot

I am going to close the issue for the time being, please somebody else confirm this.

Shout out to the amazing work on org-roam! Thank you!

vonpupp avatar Feb 25 '23 13:02 vonpupp

One thing I noticed is that after this fix, it seems that when I switch from emacs to another task and come back, the CPU spikes at 100% and it hogs a bit while the emacsql-sqlite process runs for a while, then emacs becomes responsive again. When I switch tasks and come back to emacs again, the same thing happens and so on. This happened from time to time before but not this frequent for sure.

Anyone else can confirm this behavior?

vonpupp avatar Feb 25 '23 15:02 vonpupp

I cannot confirm this exact behavior, but I also couldn't get mine to work at all in Doom Emacs until I pinned the emacsql to a previous version. Then I stopped getting the error message.

My temporary fix: I had to pin it to emacsql tag release 3.1.1 by the commit hash. So this worked: (package! emacsql :pin "c1a4407") in Doom's packages.el

DominikMendel avatar Feb 25 '23 15:02 DominikMendel

I did that but keep getting these hogs on every task switching which makes org-roam not very usable at this time. Yours is not freezing on task switching out of emacs?

vonpupp avatar Mar 01 '23 10:03 vonpupp

No I don't have any issues after an initial startup + org-roam-db-sync. I have probably 1-2k files so the sync maybtakeba minute. However it's only something I have to do once a day because I am on multiple machines. Make sure you're not constantly syncing for whatever reason, maybe a custom functions?

DominikMendel avatar Mar 01 '23 12:03 DominikMendel

I keep having these cpu spikes every time I switch to another task and come back to emacs. org-roam-db-autosync-mode was enable by default. I disabled it also, but the behavior is the same. I am not sure what is going on, nor how to even debug this issue.

Are you still using that pinned version you mentioned before?

vonpupp avatar Mar 05 '23 20:03 vonpupp

I keep having these cpu spikes every time I switch to another task and come back to emacs. org-roam-db-autosync-mode was enable by default. I disabled it also, but the behavior is the same. I am not sure what is going on, nor how to even debug this issue.

Are you still using that pinned version you mentioned before?

I was using pinned version just fine. I just tried unpinning and syncing again and everything worked fine. So looks like the issue has been resolved at least on my end without needing the pin fix.

I have not experienced the issue you are describing with the cpu throttling. How large is your org-roam DB of files? I also have org-roam-db-autosync-mode t.

If you are on Doom here are some steps that you might find helpful. Delete the emacsql repo and then re-sync. rm -rf ~/.emacs.d/.local/straight/{repos,build-*}/emacsql* doom sync -u

DominikMendel avatar Mar 05 '23 20:03 DominikMendel

Thank you for your help Dominik.

I tried that but sadly it doesn't seem to work for me. I am unsure why. Here is how the process looks like when it becomes unresponsive while using emacs-sqlite.

vonpupp avatar Mar 07 '23 18:03 vonpupp

One of the interesting things I have noticed is that this behavior only happens in the emacs GUI, not on the terminal. At least now I can continue to use emacs, but it is still very weird.

vonpupp avatar Mar 16 '23 12:03 vonpupp

I ran into a similar issue recently after upgrading Doom. What worked for me was opening up the emacs GUI, then running org-roam-db-sync which will recompile the emacs sqlite binary.

newvicklee avatar Apr 19 '23 03:04 newvicklee

Thank you for your reply. Sadly this didn't work for me. What is working so far is using emacs on the terminal rather than with the GUI. It works, but I don't have the GUI goodies. It is the best I could come with so far.

vonpupp avatar Jul 25 '23 00:07 vonpupp