Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

including gpb as dependency in erlang.mk, fails relx when generating a release #94

Closed
orotemo opened this issue Oct 20, 2016 · 18 comments
Closed

Comments

@orotemo
Copy link

orotemo commented Oct 20, 2016

the usual erlang.mk build process

wget https://erlang.mk/erlang.mk
make -f erlang.mk bootstrap-rel
make -f erlang.mk new-app in=an_app

Then create a Makefile in the root dir:

LOCAL_DEPS = an_app
TEST_DEPS = sync meck

include erlang.mk

and in the new app (named 'an_app') apps/an_app/Makefile:

PROJECT = an_app
PROJECT_DESCRIPTION = New project
PROJECT_VERSION = 0.0.1

DEPS += gpb

include ../../erlang.mk

run make, and it fails. the relx.

Didn't quite get to the root of the problem. sorry about that.

@lukebakken
Copy link
Contributor

Which version of erlang are you using?

@lukebakken
Copy link
Contributor

I'm using 19.1 and getting the following relx error, which appears to be the same as described in erlware/relx#52

gpb-94-make.txt

@tomas-abrahamsson
Copy link
Owner

@orotemo, did you get the same error as @lukebakken? If so, it seems the vsn in ebin/gpb.app does not get correctly substituted (not at all) when created from src/gpb.app.src. Will take a look.

@orotemo
Copy link
Author

orotemo commented Oct 20, 2016

@tomas-abrahamsson yes! Thanks.

@tomas-abrahamsson
Copy link
Owner

Hmm.. preliminary diagnosis, it looks like (a) erlang.mk builds gpb on its own instead of using deps/gpb/Makefile or rebar, and (b) does does not support the {vsn,{cmd,Cmd}} format that gpb uses and rebar supports (as does deps/gpb/Makefile)

I've yet to dig into (a).

This leads to the {cmd,Cmd} landing unmodified as vsn value into deps/gpb/gpb.app, which subsequently---and rightfully, I think---leads to problems when relx sees this.

Don't have any solution yet, though.. (Many Thanks for complete steps to recreate the issue!)

@lukebakken
Copy link
Contributor

lukebakken commented Oct 20, 2016

Adding NO_AUTOPATCH will cause erlang.mk to use the Makefile from gpb:

https://github.com/lukebakken/gpb_94/blob/master/Makefile#L5

However, I don't see any of the gpb build output in _rel.

Some info here about autopatching.

@lukebakken
Copy link
Contributor

If I add gpb to DEPS in the top-level Makefile, the _rel dir does contain the correct output.

Top level Makefile change.

Output:

$ ll _rel/gpb_94_release/lib/gpb
gpb-3.26.3/   gpb_94-0.0.1/ 

$ ll _rel/gpb_94_release/lib/gpb-3.26.3/
total 24
drwxr-xr-x 6 lbakken lbakken 4096 Oct 20 14:38 .
drwxr-xr-x 6 lbakken lbakken 4096 Oct 20 14:38 ..
drwxr-xr-x 2 lbakken lbakken 4096 Oct 20 14:38 ebin
drwxr-xr-x 2 lbakken lbakken 4096 Oct 20 14:38 include
drwxr-xr-x 3 lbakken lbakken 4096 Oct 20 14:38 priv
drwxr-xr-x 2 lbakken lbakken 4096 Oct 20 14:38 src

@tomas-abrahamsson
Copy link
Owner

Thanks @lukebakken for digging further!

So one need DEPS += gpb twice, both in apps/an_app/Makefile in the top level Makefile, and in the top level, one also needs NO_AUTOPATCH += gpb. Is this double need of DEPS += gpb common procedure with relx and erlang.mk to get deps into the release or does it need to be addressed somehow? (I don't know; I haven't done this a lot)

@lukebakken
Copy link
Contributor

I really don't know, myself. I've only used erlang.mk for basic projects.

It appears you can remove DEPS from apps/an_app/Makefile and the build succeeds. I'm not sure if it would work if you have code in an_app that depends on gpb, however.

@tomas-abrahamsson
Copy link
Owner

@orotemo do you think the solution by @lukebakken works well enough?

@orotemo
Copy link
Author

orotemo commented Nov 17, 2016

@tomas-abrahamsson @lukebakken: sorry for taking so long, and thank you. I managed with this solution. anyway, maybe for @essen this is just a short look to help us understand what needs to change to resolve this.

@essen
Copy link

essen commented Nov 17, 2016

The vsn not being supported is a known issue. The double DEPS is more surprising and sounds like a bug in Erlang.mk.

@tomas-abrahamsson
Copy link
Owner

How should we move forward on this?

Regarding double DEPS, should be continued as an issue on Erlang.mk?

Regarding vsn, I suppose NO_AUTOPATCH += gpb is ok for you, @orotemo? From a gpb point-of-view this would be preferrable, so that all of gpb builds.

@essen
Copy link

essen commented Nov 19, 2016

Actually I think I see the problem. Autopatch should not run, yet it does because it sees rebar on the following line: https://github.com/tomas-abrahamsson/gpb/blob/master/Makefile#L125

But since rebar is not used, and you don't do anything special with dependencies, we have no reason to run autopatch. I have to fix Erlang.mk to ignore comments when looking for rebar usage.

@tomas-abrahamsson
Copy link
Owner

Ok, I see. I'll be more or less offline for a few days from now, but rephrasing is quick, so should it still be needed by then, I'll do that.

@essen
Copy link

essen commented Nov 19, 2016

Oddly enough Erlang doesn't care if the vsn key is a tuple when loading the application. That's why it wasn't detected in the nightly build.

The fix is in, you can close this: ninenines/erlang.mk@a8fffe1

Thanks!

@tomas-abrahamsson
Copy link
Owner

Excellent! Closing. @orotemo, should anything surface, just reopen or open a new.

@essen
Copy link

essen commented Nov 21, 2016

I've opened ninenines/erlang.mk#633 for the double DEPS thing, FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants