Compiling eredis with elixir 1.15 breaks compilation

I have a dependency on eredis and when compiling it in my mix project with either erlang 25 or 26 and elixir 1.15 it fails with the following reason:

==> eredis
Compiling 7 files (.erl)
src/eredis_parser.erl:25:14: can't find include lib "eunit/include/eunit.hrl"
%   25| -include_lib("eunit/include/eunit.hrl").
%     |              ^

if I compile eredis directly with rebar3 it just generates the app properly in erlang 26:

===> Fetching rebar3_fmt v1.18.0
===> Analyzing applications...
===> Compiling rebar3_fmt
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling eredis

also with elixir 1.14.5 with either erlang 25 or 26 it is able to compile the lib.

just asking here to see if anyone had similar issue and was able to fix it before reporting in the issue tracker.

2 Likes

Check out the " Potential incompatibilities" section here: Release v1.15.0 · elixir-lang/elixir · GitHub

Maybe changing that setting in mix.exs will help, though make sure to test in prod mode as well.

Did you find a solution? How do you compile eredis directly from an elixir project?

He said using Elixir 1.14 is working for him.

eredis needs to add :eunit to extra_applications: [...] in their mix.exs but, my suggestion, is to remove the mix.exs file altogether. Elixir can compile rebar3 projects just fine.

That said, if you want to run on Elixir v1.15, you can also ask Mix to use rebar:

{:eredis, ..., manager: :rebar3}
1 Like

I can’t find this in Elixir’s 1.15 release notes, it seems I am not making the right brain connections. Still good to know and I am bookmarking your comment for future reference.

FWIW it looks like the eunit dependency was dropped from eredis: Removed usage of eunit from `eredis_parser.erl` by anthonator · Pull Request #80 · Nordix/eredis · GitHub

Perhaps upgrading to 1.7.1 will fix the issue too?

EDIT: I think it does

1 Like

setting the manager to rebar3 works for compiling/dev environment but when running releases it doesn’t work, i’m assuming because eunit is not included in the release. I guess we would need to add :eunit as extra applications when you’re depending on eredis. moving to 1.7.1 fixes it, as @iarekk posted.

1 Like

Ah, makes sense. The reason why we implemented this functionality in v1.15 was exactly to catch bugs like these (in addition to improving performance).

2 Likes