ejabberd icon indicating copy to clipboard operation
ejabberd copied to clipboard

Crash compiling ejabberd with Erlang/OTP 27.0-rc2

Open badlop opened this issue 1 year ago • 0 comments

In Erlang/OTP 27.0-rc2, code:lib_dir/2 was marked as deprecated: https://erlang.org/documentation/doc-15.0-rc2/doc/deprecations.html#otp-27

Several libraries required by ejabberd include C source code and use rebar3, so they depend on the port_compiler rebar3 plugin (see pc in hex.pm and port_compiler in github).

That plugin uses the deprecated function in https://github.com/blt/port_compiler/blob/master/src/pc_port_env.erl#L190

This itself is not an urgent problem, it just means we all should stop using that function as soon as possible.

Unfortunately, port_compiler has the erlang option warnings_as_errors enabled: https://github.com/blt/port_compiler/blob/master/rebar.config#L13 and consequently, the erlang 27.0-rc2 compiler warning is considered a compilation error.

The result is that, when compiling ejabberd or many of its dependencies, compilation crashes with a message like:

===> Analyzing applications...
===> Compiling configure_deps
===> Verifying dependencies...
===> Fetching base64url v1.0.1
===> Fetching cache_tab v1.0.30
===> Fetching pc v1.14.0
===> Analyzing applications...
===> Compiling pc
===> Compiling _build/default/plugins/pc/src/pc_port_env.erl failed
_build/default/plugins/pc/src/pc_port_env.erl:190:10: code:lib_dir/2 is deprecated; this functionality will be removed in a future release

===> Errors loading plugin pc. Run rebar3 with DEBUG=1 set to see 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"`
make: *** [Makefile:215: _build/default/lib/.built] Error 1

This problem appears when compiling ejabberd with rebar3, mix, or whatever, because the dependencies themselves use rebar3 as compilation method.


A related fix was committed to rebar3 in https://github.com/erlang/rebar3/commit/17f6861c1540d8e4df586f29cb2d4e490e8f4bb7

However, a fixed rebar3 release was not yet published.


This is already reported in port_compiler, a fix is ready, and just awaiting a release: https://github.com/blt/port_compiler/issues/79

badlop avatar Mar 28 '24 00:03 badlop