noxdafox / rabbitmq-cloudwatch-exporter

RabbitMQ Plugin for publishing cluster metrics to AWS CloudWatch
Mozilla Public License 2.0
41 stars 9 forks source link

Fail to build on Elixir 1.9 #9

Closed Bacto closed 5 years ago

Bacto commented 5 years ago

Hi, I tried to build from sources cloudWatch exporter and unfortunately it fails with Elixir 1.9 with the following error:

** (UndefinedFunctionError) function Mix.Dep.loaded/1 is undefined or private
    (mix) Mix.Dep.loaded([env: :dev])
    lib/mix/tasks/archive/build.deps.ex:72: Mix.Tasks.Archive.Build.Deps.list/1
    lib/mix/tasks/archive/build.deps.ex:54: Mix.Tasks.Archive.Build.Deps.build_archives/1
    lib/mix/tasks/archive/build.all.ex:62: Mix.Tasks.Archive.Build.All.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (elixir) lib/enum.ex:783: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:783: Enum.each/2
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
make[1]: *** [/tmp/rabbitmq-cloudwatch-exporter/deps/rabbit_common/mk/rabbitmq-dist.mk:185: plugins/rabbitmq_cloudwatch_exporter-0.2.1.ez] Error 1
make[1]: Leaving directory '/tmp/rabbitmq-cloudwatch-exporter'
make: *** [/tmp/rabbitmq-cloudwatch-exporter/deps/rabbit_common/mk/rabbitmq-dist.mk:201: dist] Error 2

It seems that Mix.Dep.loaded has been removed from Elixir 1.9.

How to reproduce:

Start an Elixir 1.9.1 container with docker run -it elixir:1.9.1 /bin/bash

Then build the plugin as usual:

apt-get update && apt-get install -y zip rsync
git clone https://github.com/noxdafox/rabbitmq-cloudwatch-exporter.git
cd rabbitmq-cloudwatch-exporter
make dist

Best, Adrien

Bacto commented 5 years ago

FYI, it seems to be linked to mix_task_archive_deps (see https://github.com/rabbitmq/mix_task_archive_deps/blob/master/lib/mix/tasks/archive/build.deps.ex#L72).

Unfortunately issues are not opened on their side.

I've checked the official RabbitMQ plugin creation tutorial (https://www.rabbitmq.com/plugin-development.html) and it seems they are not using mix_task_archive_deps. Maybe it is possible to remove it from rabbitmq-cloudwatch-exporter?

noxdafox commented 5 years ago

Hello,

thanks for reporting this, I will try reproducing it as soon as possible and contact RMQ accordingly.

noxdafox commented 5 years ago

I can confirm the issue.

I am assuming the RMQ community to be somewhat aware of the problem as the parent repository is having both an issue and a PR opened to fix the problem. https://github.com/hairyhum/mix_task_archive_deps

I guess as a workaround, you can try to apply the patch in this PR: https://github.com/hairyhum/mix_task_archive_deps/pull/2

Bacto commented 5 years ago

Thank you for your reactivity @noxdafox, I'll try to apply the patch :)

noxdafox commented 5 years ago

Closing the issue, let me know if you need further assistance.