Open benartuso opened 3 months ago
Which versions of rust, erlang, and elixir do you use?
I'm also getting a:
11:57:33.012 [warning] The on_load function for module xxh3 returned:
{:function_clause,
[
{:filename, :join, [{:error, :bad_name}, 'crates'],
[file: 'filename.erl', line: 453]},
{:filename, :join, 1, [file: 'filename.erl', line: 440]},
{:xxh3, :init, 0,
[
file: 'path/deps/xxh3/src/xxh3.erl',
...
]},
{:code_server, :"-handle_on_load/5-fun-0-", 1, [...]}
]}
** (UndefinedFunctionError) function :xxh3.hash128/1 is undefined (module :xxh3 is not available)
(xxh3 0.3.5) :xxh3.hash128("")
(fmv1992_content_enforcer 0.1.0) lib/fmv1992_content_enforcer.ex:20: Fmv1992ContentEnforcer.main/1
(elixir 1.13.4) lib/kernel/cli.ex:126: anonymous fn/3 in Kernel.CLI.exec_fun/2
11:57:33.012 [error] Process #PID<0.96.0> raised an exception
** (FunctionClauseError) no function clause matching in :filename.join/2
(stdlib 4.0.1) filename.erl:453: :filename.join({:error, :bad_name}, 'crates')
(stdlib 4.0.1) filename.erl:440: :filename.join/1
(xxh3 0.3.5) path/deps/xxh3/src/xxh3.erl:45: :xxh3.init/0
(kernel 8.4.2) code_server.erl:1317: anonymous fn/1 in :code_server.handle_on_load/5
make: *** [makefile:10: run] Error 1
It does work with iex -S mix
though.
By hard coding the right value to __PATH
I was able to make it work:
-define(load_nif_from_crate(__CRATE, __INIT),
(fun() ->
__APP = ?CARGO_LOAD_APP,
__PATH = "/home/myuser/myproj/deps/xxh3/priv/crates/xxh3/xxh3",
erlang:load_nif(__PATH, __INIT)
end)()
).
You might want to fix how that path discovery works.
error: could not compile
xxh3
(lib) due to 2 previous errors===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump ===> When submitting a bug report, please include the output of
rebar3 report "your command"
* (Mix) Could not compile dependency :xxh3, "/Users/ben/.mix/elixir/1-16/rebar3 bare compile --paths /Users/ben/oxen/OxenHub/_build/dev/lib//ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile xxh3 --force", update it with "mix deps.update xxh3" or clean it with "mix deps.clean xxh3"
Looks possibly related to #2, let me know if there's any other output that's useful!