There is a bug in Elixir where include was not working when we moved to the new build style. Please try Elixir master, where this bug is fixed (sorry for the troubles!).
Elixir - Can't get to Record.extract between 2 Deps
Question
I'm new to Elixir, and Erlang, so I might have skiped something basic but ...
I'm trying to use RabbitMQ within Elixir, and use a Elixir based lib (d0rc/exrabbit)
When mix deps.get , it get stuck, twice. The first problem is that dorc's exrabbit works on elixir 0.10.2-dev, and I'm running on 0.11.2 ... Soooo I just want to try to force it, just in case it works. Maybe that's the problem here :p
The second problem comes once I force deps to accept elixir to be higher.
mix deps.get
* Compiling exrabbit
Compiled lib/exrabbit/behaviour.ex
Compiled lib/exrabbit/supervisor.ex
== Compilation error on file lib/exrabbit.ex ==
could not compile dependency exrabbit, mix compile failed. You can recompile this dependency with `mix deps.compile exrabbit` or update it with `mix deps.update exrabbit`
** (RuntimeError) error parsing file /Users/-----/dev/testmongo/_build/shared/lib/rabbit_common/include/rabbit_framing.hrl, got: {:error, :enoent}
/private/tmp/elixir-PzZu/elixir-0.11.2/lib/elixir/lib/record/extractor.ex:54: Record.Extractor.read_file/1
/private/tmp/elixir-PzZu/elixir-0.11.2/lib/elixir/lib/record/extractor.ex:32: Record.Extractor.retrieve_record/2
deps/exrabbit/lib/exrabbit.ex:10: (module)
deps/exrabbit/lib/exrabbit.ex:9: (file)
The code in question is the following :
defmodule Exrabbit.Framing do
defrecord :'P_basic', Record.extract(:'P_basic', from_lib: "rabbit_common/include/rabbit_framing.hrl")
end
It seems from my point of view, that it isn't fetching information at the right place.
I checked and "rabbit_common/include/rabbit_framing.hrl" does indeed exists but not within _build directory, but within deps. Which makes sense to me.
I guess I'll have to look up in elixir patch notes if there have been updates on Record.extract that would imply something like this ... Is there something I've been missing ?
Thanks !
Solution
OTHER TIPS
I'm not exactly sure why you're getting that error, as that seems to be mostly correct. I ran into very similar problems just now with the cthulhuology/Amqp
package, and here's how I fixed it: https://github.com/cthulhuology/Amqp/pull/1
However, exrabbit seems to be mostly doing it properly. Not sure, but hopefully that PR can be of assistance since it just resolved an identical error for me.