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

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
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
GES233
I’m posting this in response to Jose’s recent tweet (Cr. link) : People are sleeping on Elixir for a coding harness: Hot-code swappi...
New
_mfierro
Hello, I wrote Stop My Hand, a Scattergories-like web application using Phoenix/LiveView as my learning project for Elixir (after readin...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews