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

erlc_options should behave more like elixirc_options #9184

Closed
hauleth opened this issue Jul 2, 2019 · 9 comments · Fixed by #9348
Closed

erlc_options should behave more like elixirc_options #9184

hauleth opened this issue Jul 2, 2019 · 9 comments · Fixed by #9348

Comments

@hauleth
Copy link
Contributor

hauleth commented Jul 2, 2019

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 22 [erts-10.4.3] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Elixir 1.8.2 (compiled with Erlang/OTP 22)
  • Operating system: macOS Mojave

Current behavior

There difference in behaviour of :elixirc_options and :elrc_options. This is the inclusion of :debug_info. In :elixirc_options it is added always (or at least seems so when running Dialyzer) while in :erlc_options it need to be explicitly stated, otherwise Dialyzer will fail with information that it cannot find Erlang Core informations.

Example repo: https://github.com/hauleth/example_error

Way to reproduce error:

mix do compile --force, dialyzer

Way to resolve error:

env DEBUG_INFO=1 mix do compile --force, dialyzer

Expected behavior

Mix should always add :debug_info option or should provide different way to ensure, that this is handled properly. Otherwise it has limited capabilities as the Erlang projects build tool.

@kelvinst
Copy link
Contributor

If we automatically add :debug_info to the list of options, there would be no way to compile it without that. Any idea? Maybe another :no_debug_info option that we handle on the mix task to not include :debug_info?

@kelvinst
Copy link
Contributor

One option though would be to make the docs clearer regarding the need to add :debug_info if you are setting that config, since it is the default value but not automatically added.

@kelvinst
Copy link
Contributor

kelvinst commented Sep 14, 2019

I say that because some people might want to disable it to make compilation faster (not even sure how faster it would be though). That makes me wonder if there is a way to do the same for elixir compiler, and if we should actually have that.

@josevalim
Copy link
Member

josevalim commented Sep 14, 2019 via email

@kelvinst
Copy link
Contributor

The elixir compiler supports :no_debug_info so we should probably do the same here.

I'm just curious how, because I don't see that anywhere on the codebase. Anyway, I can work on a PR for this.

@josevalim
Copy link
Member

Hrm, I may be misremembering then. Perhaps it is debug_info: false? It would be in elixir_erl.erl or similar. :)

@kelvinst
Copy link
Contributor

Perhaps it is debug_info: false?

Yep, that's it: https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/code.ex#L979-L981

What is strange is that it says the default value for it is false. 🤷‍♂ I think the docs there are just wrong, tested on a empty new project:

iex(1)> Code.get_compiler_option(:debug_info)
true

@josevalim
Copy link
Member

josevalim commented Sep 14, 2019 via email

@kelvinst
Copy link
Contributor

I've just checked and actually the options [{:debug_info, false}, :debug_info] are valid ones and it reads false for :debug_info, so just adding the :debug_info here is enough, and if anyone wants to disable :debug_info just have to set debug_info: false on the project :erlc_options.

PR coming soon.

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

Successfully merging a pull request may close this issue.

3 participants