4

I've installed org-roam (Windows 10, 26.3 x86_64-w64-mingw32) but when I try to call org-roam... then Emacs show:

Loading d:/MEGAsync/Emacs/config/init.el (source)...done
Could not find C compiler, skipping SQLite build
Org-roam initialization: (error "No EmacSQL SQLite binary available, aborting")
Could not find C compiler, skipping SQLite build
emacsql-sqlite-ensure-binary: No EmacSQL SQLite binary available, aborting

Please help :-)

laplace
  • 43
  • 1
  • 3
  • I had a similar problem on Mac OS and search led me here. I upgraded Emacs to 27.2-3 from https://emacsformacosx.com/ and the problem went away. – GrantJ Jan 03 '22 at 18:35

3 Answers3

6

I solved this issue by doing the following steps:

  1. Install Chocolatey package manager

  2. Install emacs, sqlite, mingw and msys2 using chocolatey

choco install emacs sqlite msys2 mingw -y
  1. Open your configuration file or your init.el file in your .emacs.d directory and copy paste the following code and save it. For more details, visit org-roam user manual
(use-package org-roam :ensure t)
  1. Open emacs to force it to download the org-roam packages

  2. Open msys2 and execute the following commands (These steps may not be necessary, however it is recommended based on the MSYS2 Website):

pacman -Syu
pacman -Su
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
  1. Open msys2 and execute the following command:
pacman -S gcc
  1. While still inside msys2, navigate to your downloaded emacs-sqlite package located in your .emacs.d. In my case, it is located here: C:\Users\User\AppData\Roaming\.emacs.d\elpa\emacsql-sqlite-20190727.1710\sqlite. Therefore, the command was:
cd C:/Users/User/AppData/Roaming/.emacs.d/elpa/emacsql-sqlite-20190727.1710/sqlite

if you're using Spacemacs, then sqlite will be in a different folder like:

C:/Users/User/AppData/Roaming/.emacs.d/elpa/27.2/develop/emacsql-sqlite-20190727.1710
  1. In your emacsql-sqlite/sqlite directory, you should have these four files:
  • emacsql.c
  • Makefile
  • sqlite3.c
  • sqlite3.h
  1. While inside emacsql-sqlite/sqlite directory, execute the following command:
make emacsql-sqlite CC=gcc LDLIBS=
  1. Now you should have an additional file called emacsql-sqlite.exe.

  2. Lastly, just restart your emacs and you are good to go.

Hope this help anybody in the future.

Gangula
  • 149
  • 4
  • Thank you @Naim, this helped in installation. But I'm not able to use org-roam, I'm receiving a `Selecting Deleted buffer` error. Do you have any idea how to solve it? – Gangula Sep 10 '21 at 17:16
  • along with these steps, I also had to install **mingw** to get it to work in my windows PC. After step 2, you need to install mingw using `choco install mingw` – Gangula Sep 18 '21 at 19:41
  • Thank you! You recipe worked as you say for Emacs 28 and org-roam Melpa version 20221203.1750. – mobatemacs Dec 04 '22 at 20:47
1

I solved this issue, and a similar one (org-roam cannot find executable sqlite3) by downloading manually the binary of SQLite for Windows.

Download, unzip, and put the executable at a location known by Windows PATH (or set its location in the PATH variable, in the Environment Variables). Reload Emacs, and it works!

kotchwane
  • 481
  • 2
  • 12
  • can you confirm if you've downloaded the "sqlite-tools-win32-x86-3360000.zip". Also can you add the location of "`Windows PATH`" in your case. I tried placing the sqlite3.exe file in `.emacs.d` folder, but it didn't work!! – Gangula Sep 16 '21 at 11:07
0

The error originates from https://github.com/skeeto/emacsql/blob/master/emacsql-sqlite.el which checks whether there's a binary created from a previous compilation, then attempts to build it on your system. You haven't built one yet and don't have a toolchain set up, so it errors out early.

https://github.com/skeeto/emacsql/issues/55#issuecomment-515704368 gives a short introduction into the many possible ways of compiling C programs on Windows. I second the recommendation of setting up a mingw-w64 environment, be it with or without msys2.

wasamasa
  • 21,803
  • 1
  • 65
  • 97