Reputation: 302
I'm getting back at an old phoenix project I stopped working on 3 years ago. While trying to compile it, I keep having an error I couldn't resolve for the whole afternoon.
== Compilation error in file lib/mppm/game_server/server_config.ex ==
** (ArgumentError) lib file xmerl-2.0/include/xmerl.hrl could not be found
(elixir 1.17.2) lib/record/extractor.ex:41: Record.Extractor.from_lib_file/1
(elixir 1.17.2) lib/record/extractor.ex:18: Record.Extractor.from_or_from_lib_file/1
(elixir 1.17.2) lib/record/extractor.ex:5: Record.Extractor.extract/2
lib/mppm/game_server/server_config.ex:9: (module)
With the culprit line being:
defrecord(:xmlElement, extract(:xmlElement, from_lib: "xmerl/include/xmerl.hrl"))
I installed both Elixir (1.17) and Erlang/OTP (27.0.1) with asdf. I've checked the path where erlang libraries are (.asdf/installs/erlang/27.0.1/lib/
). "xmerl" appears as "xmerl-2.0" so I tried correcting it, no luck. I tried absolute path and quite everything, including naively removing the from_lib argument, still no luck.
What am I missing here? I'm sure it's dumb, but I've been stuck for hours...
Thank you!
Upvotes: 1
Views: 155
Reputation: 121000
Since v1.15
, elixir compiler prunes code pathes if it does not see them needed. erlang core suffers from that.
Add the following line into project/0
callback of your mix.exs
.
def project do
[
…
prune_code_paths: Mix.env() == :prod,
…
]
Upvotes: 3