erlware / relx

Sane, simple release creation for Erlang
http://erlware.github.io/relx
Apache License 2.0
697 stars 232 forks source link

Usage of no_debug_info #496

Closed eproxus closed 7 years ago

eproxus commented 8 years ago

Is there a reason the option no_debug_info is used in the Rebar configuration? This prevents running Dialyzer on projects which have Relx as a dependency:

dialyzer: Could not get abstract code for file: deps/relx/ebin/relx.beam (please recompile it with +debug_info)
ferd commented 8 years ago

Rebar3 uses it in the configuration to turn down the size of the compiled escript, which turns out to have important performance impact on more constrained platforms (like raspberry pis), as far as I can remember.

tsloughter commented 8 years ago

Hm yea, but dialyzer should use your relx dep not the one in the escript. So def a bug.

Tristan Sloughter t@crashfast.com

On Tue, Jul 12, 2016, at 05:05 AM, Fred Hebert wrote:

Rebar3 uses it in the configuration to turn down the size of the compiled escript, which turns out to have important performance impact on more constrained platforms (like raspberry pis), as far as I can remember. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub[1], or mute the thread[2].

Links:

  1. https://github.com/erlware/relx/issues/496#issuecomment-232027522
  2. https://github.com/notifications/unsubscribe/AACNg6g_0dLVAI-DNVsr3VLJQU7fwXWFks5qU4L7gaJpZM4JKMF5
lrascao commented 7 years ago

@eproxus maybe the dialyze profile introduced in 57532fd1 fixes this?

eproxus commented 7 years ago

@lrascao Not sure if that would get picked up when Relx is a dependency of another project.

lrascao commented 7 years ago

do you have a public project where this is happening that i can take a look at?

eproxus commented 7 years ago

@lrascao We used the following Elixir mix task, which had Relx as a dependency ({:relx, "~> 3.20"}):

https://gist.github.com/eproxus/8529262fdef8254c5ed404eed7ef4fd1

lrascao commented 7 years ago

@eproxus do you have a simpler project? can't really get any of this to work (terrible at Elixir)

eproxus commented 7 years ago

@lrascao I think the problem is just that Relx is always built without debug info. It doesn't matter if it is then used in an Erlang or Elixir project, any Dialyzer task would not work for a project that has Relx as a dependency.

lrascao commented 7 years ago

for an Erlang project (that uses rebar3) i'm able to specify a profile that overrides erl_opts in order to add the debug_info element, something like this:

{profiles, [
     {dialyze, [
         {overrides, [
             {add, relx, [{erl_opts, [debug_info]}]},
             {erl_opts, [debug_info]}
         ]}
     ]}
 ]}.

is there something similar for Elixir?

eproxus commented 7 years ago

No idea if that is possible in Elixir. Maybe the compile opts can be overridden somehow.

Basic question: Why is debug_info disabled at all for Relx in the first place?

lrascao commented 7 years ago

I think ferd already discussed the reason, mainly to turn down binary size

eproxus commented 7 years ago

I think as far as tradeoffs go it is more likely that people want to build tools on top of Relx than run it on a Raspberry Pi, but that's just my 2 cents. 🙂 (I.e. I rather the debug_info being enabled by default as one would expect, and then disable it for special builds)

tsloughter commented 7 years ago

It is the config for building the default relx escript which should not, and people don't expect it to, have debug_info. If relx is used as a dependency of a tool that wants it to have debug_info it should enable override the config to enable.

tsloughter commented 7 years ago

Which is what we do in rebar3 to run dialyzer on the project: https://github.com/erlang/rebar3/blob/master/rebar.config#L43-L52

OvermindDL1 commented 7 years ago

Same issue, still cannot run dialyzer over relx-as-a-dependency in 2017.

tsloughter commented 7 years ago

If you are using it as a dependency and want to turn on debug_info you can use overrides.

OvermindDL1 commented 7 years ago

If you are using it as a dependency and want to turn on debug_info you can use overrides.

I'm using mix and dialyxer, any clue how to add those there?

tsloughter commented 7 years ago

Ah, I don't know, you'll have to ask someone who knows mix if it can make overrides work.

josevalim commented 7 years ago

@tsloughter I would like to propose an alternative though. Why don't we always include the debug_info and then change the escript task/command to strip debug_info? If stripping debug_info is important to reduce the size of escripts, then I believe we should do it automatically for the majority of escripts, instead of manually changing the few cases we control. What do you think? I would do the same changes to Mix as well.

lrascao commented 7 years ago

@ferd maybe Jose's idea is doable, both on rebar3 and relx escript, is there an escriptize profile that can be overridden?

ferd commented 7 years ago

Currently there is not. Relx's bootstrap script (and README instructions) could define one and make use of it though.

lrascao commented 7 years ago

closing via #575