Vagabond / erlang-syslog

Erlang port driver for interacting with syslog via syslog(3)
Other
87 stars 56 forks source link

Is the package broken with the latest rebar? #37

Closed rwngallego closed 4 years ago

rwngallego commented 4 years ago

I don't know if something has changed recently in rebar3 but currently it's not possible to get this working. Basically it cannot generate the syslog_drv.so driver. I've tried with different versions of elixir (1.6 / 1.10) but the result is the same.

In my case it's failing silently when compiling it as a dependency of ex_syslogger, it crashes when starting the application saying it could not found the syslog_drv driver. This looks like something similar to what is reported in this Pull Request: https://github.com/Vagabond/erlang-syslog/pull/36

rwngallego commented 4 years ago

@slashmili any ideas regarding this? It's actually breaking ex_syslogger.

slashmili commented 4 years ago

@rwngallego should be fixed by #38 and #36

rwngallego commented 4 years ago

Thank you very much! @slashmili are you planning to pin it in ex_syslogger and probably release a new version? Currently it's pinned to ~> 1.0.5 so it won't pick the latest erlang-syslog package (which now is 1.1.0).

slashmili commented 4 years ago

@rwngallego it's done https://hex.pm/packages/ex_syslogger/1.5.2

BrainBlasted commented 3 years ago

For some reason I still can't compile ex_syslogger 1.5.2 even with the latest version of syslog

BrainBlasted commented 3 years ago

Build log:

===> Compiling syslog
===> run_hooks("/home/pleroma/pleroma/deps/syslog", pre_hooks, compile) -> no hooks defined

===> run_hooks("/home/pleroma/pleroma/deps/syslog", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info,warn_untyped_record,{d,namespaced_types}]
===> files to compile ["/home/pleroma/pleroma/deps/syslog/src/syslog_app.erl",
                       "/home/pleroma/pleroma/deps/syslog/src/syslog_sup.erl",
                       "/home/pleroma/pleroma/deps/syslog/src/syslog.erl"]
===> run_hooks("/home/pleroma/pleroma/deps/syslog", post_hooks, erlc_compile) -> no hooks defined

===> run_hooks("/home/pleroma/pleroma/deps/syslog", pre_hooks, app_compile) -> no hooks defined

===> run_hooks("/home/pleroma/pleroma/deps/syslog", post_hooks, app_compile) -> no hooks defined

===> Provider: {pc,compile}
===> run_hooks("/home/pleroma/pleroma/deps/syslog", pre_hooks, {pc,compile}) -> no hooks defined

===> Linking priv/syslog_drv.so
===> sh info:
    cwd: "/home/pleroma/pleroma/deps/syslog"
    cmd: cc c_src/syslog_drv.o $LDFLAGS -shared  -L"/usr/lib/erlang/lib/erl_interface-4.0/lib" -lerl_interface -lei -o priv/syslog_drv.so

===>    opts: [{env,[{"AR","ar"},
                     {"AS","as"},
                     {"BINDIR","/usr/lib/erlang/erts-11.0.2/bin"},
                     {"CC","cc"},
                     {"CPP","cpp"},
                     {"CXX","c++"},
                     {"DEBUG","1"},
                     {"DRV_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_CFLAGS",
                      "-g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"  "},
                     {"DRV_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_LDFLAGS",
                      "-shared  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei"},
                     {"DRV_LINK_CXX_TEMPLATE",
                      "c++ $PORT_IN_FILES $LDFLAGS -shared  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"DRV_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS -shared  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"EMU","beam"},
                     {"ERLANG_ARCH","64"},
                     {"ERLANG_TARGET","23.0.2-x86_64-unknown-linux-gnu-64"},
                     {"ERL_CFLAGS",
                      " -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"  "},
                     {"ERL_EI_LIBDIR",
                      "\"/usr/lib/erlang/lib/erl_interface-4.0/lib\""},
                     {"ERL_LDFLAGS",
                      " -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei"},
                     {"ESCRIPT_NAME","/home/pleroma/.mix/rebar3"},
                     {"EXE_CC_TEMPLATE",
                      "cc -c $CFLAGS -g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_CFLAGS",
                      "-g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"  "},
                     {"EXE_CXX_TEMPLATE",
                      "c++ -c $CXXFLAGS -g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_LDFLAGS",
                      " -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei"},
                     {"EXE_LINK_CXX_TEMPLATE",
                      "c++ $PORT_IN_FILES $LDFLAGS  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"EXE_LINK_TEMPLATE",
                      "cc $PORT_IN_FILES $LDFLAGS  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"HOME","/home/pleroma"},
                     {"LANG","en_US.UTF-8"},
                     {"LD","ld"},
                     {"LOGNAME","pleroma"},
                     {"MAIL","/var/mail/pleroma"},
                     {"MIX_ENV","prod"},
                     {"NM","nm"},
                     {"OBJCOPY","objcopy"},
                     {"OBJDUMP","objdump"},
                     {"OLDPWD","/home/pleroma"},
                     {"PATH",
                      "/usr/lib/erlang/erts-11.0.2/bin:/usr/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"},
                     {"PROGNAME","erl"},
                     {"PWD","/home/pleroma/pleroma/deps/syslog"},
                     {"RANLIB","ranlib"},
                     {"REBAR_CONFIG",
                      "/home/pleroma/pleroma/_build/prod/lib/syslog/mix.rebar.config"},
                     {"ROOTDIR","/usr/lib/erlang"},
                     {"SHELL","/bin/bash"},
                     {"SHLVL","1"},
                     {"SSH_CLIENT","45.48.112.82 35208 22"},
                     {"SSH_CONNECTION","45.48.112.82 35208 206.189.190.43 22"},
                     {"SSH_TTY","/dev/pts/0"},
                     {"STRIP","strip"},
                     {"TERM","dumb"},
                     {"USER","pleroma"},
                     {"XDG_RUNTIME_DIR","/run/user/1001"},
                     {"XDG_SESSION_ID","1"},
                     {"_","/usr/bin/mix"}]},
               {cd,"/home/pleroma/pleroma/deps/syslog"}]

===> Port Cmd: cc c_src/syslog_drv.o $LDFLAGS -shared  -L"/usr/lib/erlang/lib/erl_interface-4.0/lib" -lerl_interface -lei -o priv/syslog_drv.so
Port Opts: [{env,[{"AR","ar"},
                  {"AS","as"},
                  {"BINDIR","/usr/lib/erlang/erts-11.0.2/bin"},
                  {"CC","cc"},
                  {"CPP","cpp"},
                  {"CXX","c++"},
                  {"DEBUG","1"},
                  {"DRV_CC_TEMPLATE",
                   "cc -c $CFLAGS -g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                  {"DRV_CFLAGS",
                   "-g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"  "},
                  {"DRV_CXX_TEMPLATE",
                   "c++ -c $CXXFLAGS -g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                  {"DRV_LDFLAGS",
                   "-shared  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei"},
                  {"DRV_LINK_CXX_TEMPLATE",
                   "c++ $PORT_IN_FILES $LDFLAGS -shared  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei -o $PORT_OUT_FILE"},
                  {"DRV_LINK_TEMPLATE",
                   "cc $PORT_IN_FILES $LDFLAGS -shared  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei -o $PORT_OUT_FILE"},
                  {"EMU","beam"},
                  {"ERLANG_ARCH","64"},
                  {"ERLANG_TARGET","23.0.2-x86_64-unknown-linux-gnu-64"},
                  {"ERL_CFLAGS",
                   " -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"  "},
                  {"ERL_EI_LIBDIR",
                   "\"/usr/lib/erlang/lib/erl_interface-4.0/lib\""},
                  {"ERL_LDFLAGS",
                   " -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei"},
                  {"ESCRIPT_NAME","/home/pleroma/.mix/rebar3"},
                  {"EXE_CC_TEMPLATE",
                   "cc -c $CFLAGS -g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                  {"EXE_CFLAGS",
                   "-g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"  "},
                  {"EXE_CXX_TEMPLATE",
                   "c++ -c $CXXFLAGS -g -Wall -fPIC -MMD  -I\"/usr/lib/erlang/lib/erl_interface-4.0/include\" -I\"/usr/lib/erlang/erts-11.0.2/include\"   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                  {"EXE_LDFLAGS",
                   " -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei"},
                  {"EXE_LINK_CXX_TEMPLATE",
                   "c++ $PORT_IN_FILES $LDFLAGS  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei -o $PORT_OUT_FILE"},
                  {"EXE_LINK_TEMPLATE",
                   "cc $PORT_IN_FILES $LDFLAGS  -L\"/usr/lib/erlang/lib/erl_interface-4.0/lib\" -lerl_interface -lei -o $PORT_OUT_FILE"},
                  {"HOME","/home/pleroma"},
                  {"LANG","en_US.UTF-8"},
                  {"LD","ld"},
                  {"LOGNAME","pleroma"},
                  {"MAIL","/var/mail/pleroma"},
                  {"MIX_ENV","prod"},
                  {"NM","nm"},
                  {"OBJCOPY","objcopy"},
                  {"OBJDUMP","objdump"},
                  {"OLDPWD","/home/pleroma"},
                  {"PATH",
                   "/usr/lib/erlang/erts-11.0.2/bin:/usr/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"},
                  {"PROGNAME","erl"},
                  {"PWD","/home/pleroma/pleroma/deps/syslog"},
                  {"RANLIB","ranlib"},
                  {"REBAR_CONFIG",
                   "/home/pleroma/pleroma/_build/prod/lib/syslog/mix.rebar.config"},
                  {"ROOTDIR","/usr/lib/erlang"},
                  {"SHELL","/bin/bash"},
                  {"SHLVL","1"},
                  {"SSH_CLIENT","45.48.112.82 35208 22"},
                  {"SSH_CONNECTION","45.48.112.82 35208 206.189.190.43 22"},
                  {"SSH_TTY","/dev/pts/0"},
                  {"STRIP","strip"},
                  {"TERM","dumb"},
                  {"USER","pleroma"},
                  {"XDG_RUNTIME_DIR","/run/user/1001"},
                  {"XDG_SESSION_ID","1"},
                  {"_","/usr/bin/mix"}]},
            {cd,"/home/pleroma/pleroma/deps/syslog"},
            exit_status,
            {line,16384},
            use_stdio,stderr_to_stdout,hide,eof]

===> sh(cc c_src/syslog_drv.o $LDFLAGS -shared  -L"/usr/lib/erlang/lib/erl_interface-4.0/lib" -lerl_interface -lei -o priv/syslog_drv.so)
failed with return code 1 and the following output:
/usr/bin/ld: cannot find -lerl_interface
collect2: error: ld returned 1 exit status

Not sure why ld isn't picking up -lerl_interface

slashmili commented 3 years ago

You need to have erlang-dev package installed. Depends on your Linux flavour the name might be different.

BTW I just clone the project and compiled it without an issue. I should mention that I'm using asdf which installs the Erlang from source and compiles it.

BrainBlasted commented 3 years ago

I have the package installed.