magit / forge

Work with Git forges from the comfort of Magit
GNU General Public License v3.0
1.32k stars 117 forks source link

Cannot open load file: sqlite3 #552

Closed floli closed 1 year ago

floli commented 1 year ago

Forge gives that error message for any command I execute: Cannot open load file: Datei oder Verzeichnis nicht gefunden, sqlite3.

On M-x shell inside emacs:

$ which sqlite3
/usr/bin/sqlite3

Thanks!

Backtrace

Debugger entered--Lisp error: (file-missing "Cannot open load file" "Datei oder Verzeichnis nicht gefunden" "sqlite3")
  require(sqlite3)
  #f(compiled-function (#<emacsql-sqlite-module-connection emacsql-sqlite-module-connection-156d74c281ac> (:file "/home/lil2lr/.emacs.d/forge-database.sqlite"))
  apply(#f(compiled-function 
  #f(compiled-function (&rest args) #<bytecode -0x109535e35d17a32f>)(#<emacsql-sqlite-module-connection emacsql-sqlite-module-connection-156d74c281ac> (:file "/home/lil2lr/.emacs.d/forge-database.sqlite"))
  apply(#f(compiled-function (&rest args) #<bytecode -0x109535e35d17a32f>) #<emacsql-sqlite-module-connection emacsql-sqlite-module-connection-156d74c281ac> (:file "/home/lil2lr/.emacs.d/forge-database.sqlite"))
  initialize-instance(#<emacsql-sqlite-module-connection emacsql-sqlite-module-connection-156d74c281ac> (:file "/home/lil2lr/.emacs.d/forge-database.sqlite"))
  #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 0xffc56ccecf4ab6>)(emacsql-sqlite-module-connection :file "/home/lil2lr/.emacs.d/forge-database.sqlite")
  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 0xffc56ccecf4ab6>) emacsql-sqlite-module-connection (:file "/home/lil2lr/.emacs.d/forge-database.sqlite"))
  make-instance(emacsql-sqlite-module-connection :file "/home/lil2lr/.emacs.d/forge-database.sqlite")
  #f(compiled-function (class &optional livep connection-class) #<bytecode 0x3203586dccda6c3>)(forge-database nil nil)
  apply(#f(compiled-function (class &optional livep connection-class) #<bytecode 0x3203586dccda6c3>) forge-database (nil nil))
  closql-db(forge-database nil nil)
  forge-db()
  forge-sql([:select * :from repository :where (and (= forge $s1) (= owner $s2) (= name $s3))] "github.boschdevcloud.com" "Half-Dome" "athena")
  #f(compiled-function (&rest rest) "((host owner name) &optional remote demand)\n\nReturn the repository identified by HOST, OWNER and NAME." #<bytecode 0x4dc027480ee9402>)(("github.boschdevcloud.com" "Half-Dome" "athena") "origin" t)
  apply(#f(compiled-function (&rest rest) "((host owner name) &optional remote demand)\n\nReturn the repository identified by HOST, OWNER and NAME." #<bytecode 0x4dc027480ee9402>) ("github.boschdevcloud.com" "Half-Dome" "athena") ("origin" t))
  forge-get-repository(("github.boschdevcloud.com" "Half-Dome" "athena") "origin" t)
  #f(compiled-function (url &optional remote demand) "Return the repository at URL." #<bytecode -0x1460d44cd59b301e>)("https://github.boschdevcloud.com/Half-Dome/athena...." "origin" t)
  apply(#f(compiled-function (url &optional remote demand) "Return the repository at URL." #<bytecode -0x1460d44cd59b301e>) "https://github.boschdevcloud.com/Half-Dome/athena...." ("origin" t))
  forge-get-repository("https://github.boschdevcloud.com/Half-Dome/athena...." "origin" t)
  #f(compiled-function (demand &optional remote) "Return the current forge repository.\n\nIf the `forge-buffer-repository' is non-nil, then return that.\nOtherwise if `forge-buffer-topic' is non-nil, then return the\nrepository for that.  Finally if both variables are nil, then\nreturn the forge repository corresponding to the current Git\nrepository, if any." #<bytecode 0x946f0acae7d7f60>)(t)
  apply(#f(compiled-function (demand &optional remote) "Return the current forge repository.\n\nIf the `forge-buffer-repository' is non-nil, then return that.\nOtherwise if `forge-buffer-topic' is non-nil, then return the\nrepository for that.  Finally if both variables are nil, then\nreturn the forge repository corresponding to the current Git\nrepository, if any." #<bytecode 0x946f0acae7d7f60>) t nil)
  forge-get-repository(t)
  byte-code("\300\301\302!\303\"C\207" [eieio-oref forge-get-repository t id] 3)
  command-execute(forge-list-issues record)
  execute-extended-command(nil "forge-list-issues" "forge list")
  funcall-interactively(execute-extended-command nil "forge-list-issues" "forge list")
  command-execute(execute-extended-command)
tarsius commented 1 year ago

And what are the versions of emacsql and closql?

I don't think that alone will fix it, but try restarting Emacs anyway.

floli commented 1 year ago

Versions are

No, a restart hasn't fixed it. Also tried to delete the elpa folder and let everything reinstall using use-package.

DamienCassou commented 1 year ago

I have exactly the same issue:

(file-missing "Cannot open load file" "No such file or directory" "sqlite3")
DamienCassou commented 1 year ago

From what I understand, the file referenced by forge-database-file depends on Emacs' sqlite3 to be installed. The Emacs' sqlite3 package depends on the presence of the sqlite database engine to be installed. Installing both fixes the issue for me.

Maybe https://github.com/magit/forge/blob/main/forge-pkg.el should be updated to reference sqlite3?

floli commented 1 year ago

Manually installing sqlite3 from melpa fixed it for me, too.

tarsius commented 1 year ago

The user is now informed that they have to install sqlite3 and the libsqlite3 shared library, iff necessary.

Maybe https://github.com/magit/forge/blob/main/forge-pkg.el should be updated to reference sqlite3?

EmacSQL now support multiple backends. The new backend that uses the new built-in support in Emacs 29 is preferred. Only if that cannot be used (because an older release is used or Emacs has been compiled with --without-sqlite3), should the new module backend be used.

emacsql should not depend on sqlite3 because it might not be required. And if it is not required, but we try to build it anyway and fail, then that is a needless failure.

tarsius commented 1 year ago

More about the new backends and upcoming release: https://github.com/magit/emacsql/issues/113.

DamienCassou commented 1 year ago

Thank you so much @tarsius for: