Search code examples
erlangrebar

erlang lager_syslog driver failure


I'm trying to use lager_syslog in my project but it seems like a driver is missing.

This is in my rebar.conf:

    {deps, [
       ...
       {lager_syslog, {git, "https://github.com/basho/lager_syslog.git", {branch, master}}}
    ]}.

My test handler:

    {lager_syslog_backend, ["test", local1, info]},

The error:

19:29:09.981 [error] Lager failed to install handler {lager_syslog_backend,{"test",local1}} into lager_event, retrying later : {error,
   {{shutdown,
     {failed_to_start_child,
      syslog,
      "could not load driver syslog_drv: \"cannot open shared object file: No such file or directory\""}},
    {syslog_app,
     start,
     [normal,
      []]}}}

Any suggestion?


Solution

  • thanks to Kenneth Lakin who answered my question in mailing list

    IIRC, rebar3 moved the port compiler out to a rebar3 plugin, rather than packing it in with the core project. From what I've seen, rebar2 projects that relied on it will fail to load their port drivers.

    Add

    {overrides,
      [{override, syslog, [
        {plugins, [pc]},
        {artifacts, ["priv/syslog_drv.so"]},
        {provider_hooks, [
          {post,
            [
            {compile, {pc, compile}},
            {clean, {pc, clean}}
            ]
          }]
        }
      ]}
    ]}.
    

    to a rebar.conf in your project, clean, and rebuild. (The syslog project is where lager_syslog's port driver lives.)

    See also: https://github.com/blt/port_compiler#use-with-existing-dependency