ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
578 stars 241 forks source link

amqp_client dep fails when trying to build with erlang.mk #962

Closed cliveyg closed 1 year ago

cliveyg commented 1 year ago

Hi,

Mac OS version: 12.5.1 (Intel mac) Erlang installed via Brew: erlang 25.0.4

I wrote an Erlang application a few years ago and it built and ran successfully without problems. However when I went to build it again on my Mac it no longer installs the amqp_client dependency correctly (I also checked this on an Ubuntu server that used to build correctly with the same result).

Steps to reproduce:

wget https://erlang.mk/erlang.mk
make -f erlang.mk bootstrap-lib bootstrap-rel

Edit the Makefile to this:

PROJECT = badjuju
PROJECT_DESCRIPTION = New project
PROJECT_VERSION = 0.1.0

DEPS = amqp_client

include erlang.mk

Run make

The error is:

 DEP    amqp_client (master)
make[1]: Entering directory '/Users/cliveglew/dev/poptape/redux/erlang_apps/badjuju/deps/amqp_client'
 DEP    rabbit_common (master)
make[2]: Entering directory '/Users/cliveglew/dev/poptape/redux/erlang_apps/badjuju/deps/rabbit_common'
 DEP    rabbitmq_codegen (master)
error: no valid pathspec among:  master master master
make[2]: *** [erlang.mk:5091: /Users/me/dev/erlang_apps/badjuju/deps/rabbitmq_codegen] Error 1
make[2]: Leaving directory '/Users/me/dev/erlang_apps/badjuju/deps/rabbit_common'
make[1]: *** [/Users/me/dev/erlang_apps/badjuju/erlang.mk:4512: deps] Error 2
make[1]: Leaving directory '/Users/me/dev/erlang_apps/badjuju/deps/amqp_client'
make: *** [erlang.mk:4512: deps] Error 2

Other things tried:

DEPS = amqp_client dep_amqp_client = hex 3.11.0

include erlang.mk

This generates the error:
`Error: No Makefile to build dependency /Users/me/dev/erlang_apps/badjuju/deps/rabbitmq_codegen`
I also tried with the line `dep_rabbit_common = hex 3.10.8` in place of the dep_amqp_client line as recommended on the rabbit website.

- Copying the relevant amqp_client folder from the RabbitMQ server github into the deps folder of my app.  This just causes other issues such as references problems with files not found and relative path errors. I assume this is because it's now part of the rabbitmq server repo and not standalone anymore.
- I also edited the `erlang.mk` file to remove an incorrect reference to the old amqp_client repo in the hope it would use the hex version instead but no joy with that either

- Tried adding `RABBITMQ_CLIENT_PATCH = 1` to the Makefile but this gave the error:

DEP rabbit_common (master) fatal: could not create work tree dir '/Users/me/dev/erlang_apps/badjuju/deps/rabbit_common': File exists



Is there a way to install the amqp_client using erlang.mk or is this no longer feasible? Are there any workarounds?

Regards
cliveyg commented 1 year ago

I believe the error message is due to trying to fetch the archived amqp_client github. This repo defaults to master but one of it's dependencies rabbitmq_codegen has had it's default branch changed to main. The script/build process is trying to access a non-existent master branch of rabbitmq_codegen.

Is 'master' hardcoded somewhere in erlang.mk?

essen commented 1 year ago

The RABBITMQ_CLIENT_PATCH is for old versions so it should probably be removed now. The branch names are wrong since the rename, I will correct them and then check it all works fine.

essen commented 1 year ago

Oh right it's not just the branch name, the projects have been merged into a single repository. Hex seems to be the way for this now so I will look into fixing that and updating the project to use Hex directly.

essen commented 1 year ago

The Hex issue is linked to the tar file from the package, I'll keep you posted.

essen commented 1 year ago

A new package has been issued that fixes this issue: https://hex.pm/packages/amqp_client/3.11.0-1

See https://github.com/lukebakken/amqp-clients-test for example working projects. Thanks @lukebakken for the quick fixes!

cliveyg commented 1 year ago

Excellent thanks for the info.