warmwaffles

warmwaffles

During the winter storm here in Texas, I was couped up without reliable electricity so I was bored and started working on an sqlite3 nif and ecto3 adapter.

I had seen esqlite and sqlite_ecto2 and thought I would try my hand at just doing it all in elixir.

My goal with the project was to make the sqlite3 adapter as configurable as possible. Including changing cache pragma directives, full text search etc…

Anyways, I’m looking for some help knocking out bugs and finding them. I am currently using them on a personal project of mine until I can get this stable.

https://github.com/warmwaffles/exqlite

Showing Posts 1 to 10

Eiji

Eiji

I got this error:

==> exqlite
mkdir -p /tmp/mix_installs/elixir-1.12.0-dev-erts-12.0/d3fdf3d0ae84916ee0aaf0dc561b4c17/_build/dev/lib/exqlite/priv
make: *** Brak reguł do zrobienia obiektu 'sqlite3/sqlite3.c', wymaganego przez '/tmp/mix_installs/elixir-1.12.0-dev-erts-12.0/
d3fdf3d0ae84916ee0aaf0dc561b4c17/_build/dev/lib/exqlite/priv/sqlite3_nif.so'. Stop.
could not compile dependency :exqlite, "mix compile" failed. You can recompile this dependency with "mix deps.compile exqlite",
update it with "mix deps.update exqlite" or clean it with "mix deps.clean exqlite"                                             
** (Mix.Error) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. If you are using
Ubuntu or any other Debian-based system, install the packages
"build-essential". Also install "erlang-dev" package if not
included in your Erlang/OTP version. If you're on Fedora, run
"dnf group install 'Development Tools'".

(mix 1.12.0-dev) lib/mix.ex:452: Mix.raise/2
(elixir_make 0.6.2) lib/mix/tasks/compile.make.ex:143: Mix.Tasks.Compile.ElixirMake.run/1
(mix 1.12.0-dev) lib/mix/task.ex:394: Mix.Task.run_task/3
(mix 1.12.0-dev) lib/mix/tasks/compile.all.ex:90: Mix.Tasks.Compile.All.run_compiler/2
(mix 1.12.0-dev) lib/mix/tasks/compile.all.ex:70: Mix.Tasks.Compile.All.compile/4
(mix 1.12.0-dev) lib/mix/tasks/compile.all.ex:57: Mix.Tasks.Compile.All.with_logger_app/2
(mix 1.12.0-dev) lib/mix/tasks/compile.all.ex:35: Mix.Tasks.Compile.All.run/1
(mix 1.12.0-dev) lib/mix/task.ex:394: Mix.Task.run_task/3

Then tried to run make manually:

$ LC_ALL=en MIX_APP_PATH=. make clean all
rm -f ./priv/sqlite3_nif.so
mkdir -p priv
make: *** No rule to make target 'sqlite3/sqlite3.c', needed by 'priv/sqlite3_nif.so'.  Stop.

After that I have removed sqlite3/sqlite3.c from Makefile:

# SRC = sqlite3/sqlite3.c c_src/sqlite3_nif.c
SRC = c_src/sqlite3_nif.c

# …

Finally I have this error:

==> exqlite
mkdir -p /tmp/mix_installs/elixir-1.12.0-dev-erts-12.0/d3fdf3d0ae84916ee0aaf0dc561b4c17/_build/dev/lib/exqlite/priv
cc -g -O3 -Wall -I"/home/eiji/.asdf/installs/erlang/24.0-rc1/erts-12.0/include" -Isqlite3 -Ic_src -DSQLITE_THREADSAFE=1 -DSQLITE_USE_URI -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_RBU -DNDEBUG=1 -shared -fPIC -fvisibility=hidden -Wl,-soname,libsqlite3.so.0 c_src/sqlite3_nif.c -o /tmp/mix_installs/elixir-1.12.0-dev-erts-12.0/d3fdf3d0ae84916ee0aaf0dc561b4c17/_build/dev/lib/exqlite/priv/sqlite3_nif.so
Compiling 5 files (.ex)

03:04:35.140 [warn]  The on_load function for module Elixir.Exqlite.Sqlite3NIF returned:
{:error,
 {:load_failed,
  'Failed to load NIF library: \'/tmp/mix_installs/elixir-1.12.0-dev-erts-12.0/d3fdf3d0ae84916ee0aaf0dc561b4c17/_build/dev/lib/exqlite/priv/sqlite3_nif.so: undefined symbol: sqlite3_bind_int64\''}}

Generated exqlite app
** (ArgumentError) adapter Ecto.Adapters.Exqlite was not compiled, ensure it is correct and it is included as a project dependency
    (ecto 3.5.8) lib/ecto/repo/supervisor.ex:60: Ecto.Repo.Supervisor.compile_config/2
    ecto_example.exs:4: (module)
    ecto_example.exs:3: (file)

So I have checked it by ldd:

$ ldd sqlite3_nif.so 
        linux-vdso.so.1 (0x00007ffe94eb1000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f3220a46000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007f3220c41000)

Please notice that I had no errors on cc compilation.

warmwaffles

warmwaffles OP

@Eiji was this installing with mix or cloning the repository and running mix compile?

Eiji

Eiji

I have used: Mix.install([:ecto_sql, :exqlite]) from elixir’s master branch. It’s like mix deps.get, but for single file scripts.

Eiji

Eiji

Interesting … This is error from cloned repo:

$ LC_ALL=en MIX_APP_PATH=. make clean all
rm -f ./priv/sqlite3_nif.so
mkdir -p priv
cc -g -O3 -Wall -I"" -Isqlite3 -Ic_src -DSQLITE_THREADSAFE=1 -DSQLITE_USE_URI -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_OMIT_DEPRECATED -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_RBU -DNDEBUG=1 -shared -fPIC -fvisibility=hidden -Wl,-soname,libsqlite3.so.0 sqlite3/sqlite3.c c_src/sqlite3_nif.c -o priv/sqlite3_nif.so
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en)
c_src/sqlite3_nif.c:5:10: fatal error: erl_nif.h: No such file or directory
    5 | #include <erl_nif.h>
      |          ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:55: priv/sqlite3_nif.so] Error 1

Edit: mix compile on cloned repository compiled without any error.

Eiji

Eiji

ok, I found it - it’s simple sqlite3 directory is not included in hex

warmwaffles

warmwaffles OP

Odd indeed. Once we knock out some of the outstanding issues in the repo, I’ll cut a release.

warmwaffles

warmwaffles OP

Can you submit a PR for the fix?

Eiji

Eiji

sure :slight_smile:

warmwaffles

warmwaffles OP

I appreciate the help.

Where Next? Top

Trending in Discussions Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New
jtormey
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews