rabbitmq / discussions

Please use RabbitMQ mailing list for questions. Issues that are questions, discussions or lack details necessary to investigate them are moved to this repository.
3 stars 4 forks source link

can't find include lib "eunit/include/eunit.hrl" on Ubuntu with erlang-dev package #147

Closed yuklia closed 4 years ago

yuklia commented 4 years ago

I am trying to build rabbitmq-delayed-message-exchange on ubuntu:18.04

here is part of Dockerfile:

FROM rabbitmq:3.8.0-management

ENV PLUGIN_DELAYED_VERSION 3.8.0
RUN apt-get update && apt-get install -y wget make git curl python3 unzip erlang-nox erlang-dev erlang-src && \
    ln -sf python3 /usr/bin/python && \
    wget https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/archive/v${PLUGIN_DELAYED_VERSION}.zip -O plugin-delayed-message-exchange.zip && \
    unzip -q plugin-delayed-message-exchange.zip && \
    rm -rf plugin-delayed-message-exchange.zip && \
    ls -la && \
    cd rabbitmq-delayed-message-exchange-${PLUGIN_DELAYED_VERSION} && \
    make

as you can see i installed additional packages: erlang-nox erlang-dev erlang-src but with no luck:

src/rabbit_boot_state.erl:11: can't find include lib "eunit/include/eunit.hrl"
src/rabbit_boot_state.erl:30: undefined macro 'assert/1'
src/rabbit_boot_state.erl:13: function set/1 undefined
src/rabbit_boot_state.erl:27: spec for undefined function set/1
src/rabbit_boot_state.erl:61: Warning: function is_valid/1 is unused
../../erlang.mk:5441: recipe for target 'ebin/rabbitmq_prelaunch.app' failed
make[3]: *** [ebin/rabbitmq_prelaunch.app] Error 1
make[2]: *** [app] Error 2
../../erlang.mk:5183: recipe for target 'app' failed
make[2]: Leaving directory '/rabbitmq-delayed-message-exchange-3.8.0/deps/rabbit/apps/rabbitmq_prelaunch'
erlang.mk:4464: recipe for target 'apps' failed
make[1]: Leaving directory '/rabbitmq-delayed-message-exchange-3.8.0/deps/rabbit'
make[1]: *** [apps] Error 2
erlang.mk:4433: recipe for 
michaelklishin commented 4 years ago

The header that cannot be found, eunit/include/eunit.hrl, comes from EUnit, which is a separate package on Debian and Debian derivatives.

Ubuntu 18.04 provides Erlang 20.2 in its standard package repositories. RabbitMQ 3.8.0 requires Erlang 21.3 or 22.x. I doubt you would be able to build all of the dependencies on 20.2.

If I use the same package list plus a few server build dependencies, in particular Elixir, the plugin builds just fine on Ubuntu 20.04 (I added erlang-eunit to the list just in case). Actually, if Elixir is installed from the Erlang Solutions apt repo, so will be Erlang (23), which is perfectly fine.

This plugin hasn't changed in a long time. You can use a published release instead of building it from source. I don't see any reason to build it from source unless you intend to use a fork.

michaelklishin commented 4 years ago

Compared to the default Make target, make dist also required installing rsync.

apt-get install erlang-base erlang-src erlang-dev erlang-eunit make gnupg2 rsync wget
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && dpkg -i erlang-solutions_2.0_all.deb
apt-get update -y
apt-get install elixir

is a close enough approximation to what I have in this image. Again, building this plugin from source is not necessary unless the plugin has been modified.

yuklia commented 4 years ago

@michaelklishin in my case it is, unfortunately, necessary, because I need 3.8 version for rabbitmq-delayed-message-exchange. Ready to use binary exists only for 3.7 in the community https://dl.bintray.com/rabbitmq/community-plugins/3.7.x/rabbitmq_delayed_message_exchange/

my target goal is to have rabbitmq-prometheus plugin but i need 3.8 and also i need

michaelklishin commented 4 years ago

@yuklia have you looked at GitHub releases? https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/tag/v3.8.0 is 3.8-compatible. This release was produced by the RabbitMQ core team.

yuklia commented 4 years ago

yeah, really that is what i need - rabbitmq_delayed_message_exchange-3.8.0.ez i tried to unpack https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/archive/v3.8.0.zip instead ((

i am sorry for disturb, thanks a lot for help!

michaelklishin commented 4 years ago

Apparently the README was recommending the Community plugins repo on Bintray which is not really maintained any more. I have updated it to link to GH releases.