Skip to content

Compiling / running in a dev env results in exqlite errors #515

Open
@rdlu

Description

@rdlu

I'm again having some issues, with both neovim and vscode. The release version just stays forever initializing, even after doing the cleaning that I always do, but that is a separate issue.

To investigate the first issue, then I tried to clone the repo to run in dev mode with just start, or just the burrito on my own (and copy to cp burrito_out/next_ls_linux_amd64 ~/.cache/elixir-tools/nextls/bin/nextls-custom, then ln -s the custom to nextls. Then I had a different but highly reproducible issue with my system:

{:error,
 {:load_failed,
  ~c"Failed to load NIF library: 'Error loading shared library libsqlite3.so.0: No such file or directory (needed by /home/rdlu/.local/share/.burrito/next_ls_erts-14.2.5_0.22.8/lib/exqlite-0.13.15/priv/sqlite3_nif.so)'"}}


13:00:27.773 [error] ** (MatchError) no match of right hand side value: {:error, {:shutdown, {:failed_to_start_child, NextLS.DB, {:undef, [{Exqlite.Sqlite3NIF, :open, [~c"/home/rdlu/Projects/octo/.elixir-tools/nextls.db", 6], []}, {Exqlite.Connection, :do_connect, 2, [file: ~c"lib/exqlite/connection.ex", line: 517]}, {NextLS.DB, :init, 1, [file: ~c"lib/next_ls/db.ex", line: 40]}, {:gen_server, :init_it, 2, [file: ~c"gen_server.erl", line: 980]}, {:gen_server, :init_it, 6, [file: ~c"gen_server.erl", line: 935]}, {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 241]}]}}}}
    (next_ls 0.22.8) lib/next_ls.ex:933: anonymous fn/5 in NextLS.handle_notification/2
    (elixir 1.17.0-rc.1) lib/enum.ex:2531: Enum."-reduce/3-lists^foldl/2-0-"/3
    (next_ls 0.22.8) lib/next_ls.ex:928: NextLS.handle_notification/2
    (gen_lsp 0.10.0) lib/gen_lsp.ex:478: anonymous fn/2 in GenLSP.loop/3
    (telemetry 1.2.1) /home/rdlu/Projects/next-ls/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
    (gen_lsp 0.10.0) lib/gen_lsp.ex:474: anonymous fn/7 in GenLSP.loop/3
    (gen_lsp 0.10.0) lib/gen_lsp.ex:553: GenLSP.attempt/4
    (stdlib 5.2.3) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

I tried to update the exqlite inside mix.exs to 0.23.0 then mix deps.get

The message just changed to the new version:

{:error,
 {:load_failed,
  ~c"Failed to load NIF library: 'Error loading shared library libsqlite3.so.0: No such file or directory (needed by /home/rdlu/.local/share/.burrito/next_ls_erts-14.2.5_0.22.8/lib/exqlite-0.23.0/priv/sqlite3_nif.so)'"}}

So I can't investigate the other issue I'm having without loading the db.

My system:

Fedora Workstation 40
fish shell
sqlite and dev libs, version 3.45.1
all the libsqlite*.so* files are present on the /usr/include or /usr/lib64 folders

some erl, elixir flags

# Elixir / Erl
# tell exqlite that we wish to use some other sqlite installation. this will prevent sqlite3.c and friends from compiling
set -gx EXQLITE_USE_SYSTEM 1

# Tell exqlite where to find the `sqlite3.h` file
set -gx EXQLITE_SYSTEM_CFLAGS -I/usr/include

# tell exqlite which sqlite implementation to use
set -gx EXQLITE_SYSTEM_LDFLAGS '-L/usr/lib64 -lsqlite3'

# Erlang compile flags for fedora & wx-config
set -gx ERL_AFLAGS '-kernel shell_history enabled'
set -gx KERL_CONFIGURE_OPTIONS "--enable-wx --with-wx --enable-webview --with-wx-config=/usr/bin/wx-config-3.2"
set -gx KERL_BUILD_DOCS yes

I also tried removing the exqlite vars, or setting "use system" to 0. It indeed compiles by itself, but the result is the same.

my env cleaning script:

#!/usr/bin/env fish
echo "Cleaning Elixir development environment..."
rm -rfv ~/.local/share/.burrito/
rm -rfv ~/.cache/elixir-tools/

# Recompile some dependencies
mix do local.rebar --force, local.hex --force

my project cleaning justfile script:

clean-dev:
  rm -rf ./.elixir_ls ./_build ./deps ./.elixir-tools
  find . -name "*.beam" -exec rm -f {} \;

I updated the .tools-versions as well, then used mise to install the exact versions below, since the current elixir hashed version simply doesn't compile for me, but the one below is succesful:

erlang 26.2.2
elixir  v1.17-otp-26
zig 0.11.0

I have mise, but I also tried removing all mise erl/elixir installed versions, not loading mise at all, using the current system versions, the deps cache were installed to ~/.cache/mix instead the usual mise/rtx/asdf locations to run my projects with neovim/vscode + nextls.

Not sure if this is an burrito issue or what not, because just start with port 9000 causes almost the same issues.
(the logs go to the next-ls folder instead my project folder, but the same error happens).

I don't have any issues with some side projects with phoenix that uses sqlite. That's why I have the exqlite flags, to accelerate the compiling of my side projects.

Any clues? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions