elixir-sqlite / exqlite

An SQLite3 driver for Elixir
https://hexdocs.pm/exqlite
MIT License
217 stars 48 forks source link

Could not compile dependency :exqlite #272

Closed aukuste closed 10 months ago

aukuste commented 11 months ago

I seem to have an issue with getting exqlite compiled.

I updated my dependencies recently for a project, where one of them is ecto_sqlite3.

When trying to compile the project, the compilation fails when trying to compile exqlite:

==> exqlite
Downloading precompiled NIF to /home/user/.cache/exqlite-nif-2.17-x86_64-linux-gnu-0.17.0.tar.gz
could not compile dependency :exqlite, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile exqlite --force", update it with "mix deps.update exqlite" or clean it with "mix deps.clean exqlite"
** (ArgumentError) unknown application: :certifi
    (elixir 1.15.7) lib/application.ex:1010: Application.app_dir/1
    (elixir 1.15.7) lib/application.ex:1037: Application.app_dir/2
    (elixir_make 0.7.7) lib/elixir_make/artefact.ex:267: ElixirMake.Artefact.cacerts_options/0
    (elixir_make 0.7.7) lib/elixir_make/artefact.ex:244: ElixirMake.Artefact.download/1
    (elixir_make 0.7.7) lib/mix/tasks/compile.elixir_make.ex:222: Mix.Tasks.Compile.ElixirMake.download_or_reuse_nif/3
    (elixir_make 0.7.7) lib/mix/tasks/compile.elixir_make.ex:160: Mix.Tasks.Compile.ElixirMake.run/1
    (mix 1.15.7) lib/mix/task.ex:455: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.7) lib/mix/tasks/compile.all.ex:124: Mix.Tasks.Compile.All.run_compiler/2

Exqlite is version 0.17.0.

Some system info: I'm running Fedora Linux 38 Erlang version: Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns] Elixir version: Elixir 1.15.7 (compiled with Erlang/OTP 26)

Any ideas on why this is happening?

warmwaffles commented 11 months ago

Odd https://hex.pm/packages/certifi

aukuste commented 11 months ago

It seems like it's the download of exqlite-nif-2.17-x86_64-linux-gnu-0.17.0.tar.gz that just fails immediately. If I manually download that file from the github releases and place it in ~/.cache, exqlite compiles without any issues.

warmwaffles commented 11 months ago

@cocoa-xu I'm not well versed in the precompile logic, do you think you can lend a hand here?

cocoa-xu commented 11 months ago

@aukuste That's kinda strange... and I cannot reproduce it in my Linux machine (which runs Ubuntu 20.04). Maybe I'll try to find a Fedora machine and try it tomorrow. And could you please let me know the exact version of Erlang installed on your computer? I was using 26.0.2 in my setup.

$ erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell
26.0.2
aukuste commented 11 months ago

@cocoa-xu 26.2.1

aukuste commented 11 months ago

If I create a new project and add ecto_sqlite3 and ecto_sql to it, it works without problem, but if I then remove ~/.cache/exqlite-nif-2.17-x86_64-linux-gnu-0.17.0.tar.gz and add {:timex, "~> 3.7"} to the deps in mix.exs, run mix deps.get, and the mix compile, then I can reproduce the problem consistently.

ollien commented 10 months ago

I'm seeing this exact same failure signature using the official elixir:1.16.0 docker image.

josevalim commented 10 months ago

Fixed in elixir_make. Thanks @cocoa-xu for the report and initial fix.

warmwaffles commented 10 months ago

Awesome, thank you @cocoa-xu and @josevalim