#rebar3 not finding jsonx module

19 messages · Page 1 of 1 (latest)

modern willow
#

Hello,

I am building an erlang app with rebar using jsonx module, but it seems my application can't find it.

when I execute the following code:

jsonx:decode(<<"{\"name\":\"Ivan\",\"age\":33,\"phones\":[3332211,4443322]}">>)

I get this error:

2022-09-25T17:01:32.226101+03:00 error: Error in process <0.192.0> with exit value:, {{badmatch,{error,{load_failed,"Failed to load NIF library: '/home/ivelin/Desktop/auth_app/app/_build/default/lib/jsonx/priv/jsonx.so: cannot open shared object file: No such file or directory'"}}},[{jsonx,init,0,[{file,"/home/ivelin/Desktop/auth_app/app/_build/default/lib/jsonx/src/jsonx.erl"},{line,232}]},{code_server,'-handle_on_load/5-fun-0-',1,[{file,"code_server.erl"},{line,1340}]}]}

rebar.config

{erl_opts, [debug_info]}.
{deps, [
  {cowboy, {git, "https://github.com/ninenines/cowboy.git"}},
  {jsonx, ".*", {git, "https://github.com/iskra/jsonx.git"}}
]}.

{shell, [
  % {config, "config/sys.config"},
    {apps, [app]}
]}.

my app.src

{application, app,
 [{description, "An OTP application"},
  {vsn, "0.1.0"},
  {registered, []},
  {mod, {app_app, []}},
  {applications,
   [kernel,
    stdlib,
    cowboy,
    jsonx
   ]},
  {env,[]},
  {modules, []},

  {licenses, ["Apache 2.0"]},
  {links, []}
 ]}.

Why do I get this error ? How can I fix it ?

alpine bear
#

idk but it says nif lib cudnt be loaded. im not familiar with erlang, but does ur system has C installed in it? if not try installing and redo c if that changes things

modern willow
#

My system doesn't recognize redo command

#

Here's the full error

alpine bear
#

do u have C installed?

#

and did u load the nif? erlang:load_nif(...)?

modern willow
modern willow
#

Path ; Load_Info ?

#

What should I put in the Path parameter ?

alpine bear
#

lemme take a look gimmi a sec

alpine bear
#

sorry not an erlang guy but u might wanna check this out

#

the best i got is- use messagepack instead

#

sorry

modern willow
alpine bear
#

if u find something lemme know

modern willow
#

Nothing yet