Not being able to compile telemetry dependency

Hello, I’ve just created a simple Phoenix app with mix phx.new, then tried to run mix phx.server.

But, everytime I run that, it can’t compile the “telemetry” dependency. Always with the same error

**(Mix) Could not compile dependency :telemetry, "escript rebar3 bare compile --paths _build/dev/lib/*/ebin" command failed. Errors may have been logged above. 
You can recompile this dependency with "mix deps.compile telemetry --force" or clean it with "mix deps.clean telemetry"

However, if I manually run any of these commands, we go back to the same errors, also there is no errors above it, it only has the ===> Compiling telemetry message.

I’m on windows, but that shouldn’t be too much of a difference.

Versions:

Erlang/OTP 27
Elixir 1.17.3 (compiled with Erlang/OTP 25)
1 Like

First obvious question, is rebar3 available on your system?
try mix local.rebar and see if that wants to overwrite, if not install it.

Can you also please put the whole output since running mix phx.server? Remove both deps and _build folders, and then do mix deps.get and mix phx.server. Thank you :slight_smile:

1 Like

Yes! I’ve ran that multiple times and I have a separate rebar3 binary installed for gleam, tried it with both, same results

I can’t upload images for some reason, but it’s just the ===> Compiling x messages until it reaches telemetry, then it throws that error.

Here is a correct output of mix deps.compile on newly generated project:

$ mix deps.compile
==> file_system
Compiling 7 files (.ex)
Generated file_system app
==> decimal
Compiling 4 files (.ex)
Generated decimal app
==> mime
Compiling 1 file (.ex)
Generated mime app
==> nimble_options
Compiling 3 files (.ex)
Generated nimble_options app
===> Analyzing applications...
===> Compiling telemetry
==> telemetry_metrics
Compiling 7 files (.ex)
Generated telemetry_metrics app
===> Analyzing applications...
===> Compiling telemetry_poller
==> thousand_island
Compiling 16 files (.ex)
Generated thousand_island app
==> jason
Compiling 10 files (.ex)
Generated jason app
==> phoenix_html
Compiling 6 files (.ex)
Generated phoenix_html app
==> phoenix_template
Compiling 4 files (.ex)
Generated phoenix_template app
==> db_connection
Compiling 17 files (.ex)
Generated db_connection app
==> expo
Compiling 2 files (.erl)
Compiling 22 files (.ex)
Generated expo app
==> phoenix_pubsub
Compiling 11 files (.ex)
Generated phoenix_pubsub app
==> plug_crypto
Compiling 5 files (.ex)
Generated plug_crypto app
==> hpax
Compiling 4 files (.ex)
Generated hpax app
==> dns_cluster
Compiling 1 file (.ex)
Generated dns_cluster app
==> gettext
Compiling 18 files (.ex)
Generated gettext app
==> ecto
Compiling 56 files (.ex)
Generated ecto app
==> plug
Compiling 1 file (.erl)
Compiling 40 files (.ex)
Generated plug app
==> postgrex
Compiling 68 files (.ex)
Generated postgrex app
==> ecto_sql
Compiling 25 files (.ex)
Generated ecto_sql app
==> nimble_pool
Compiling 2 files (.ex)
Generated nimble_pool app
==> castore
Compiling 1 file (.ex)
Generated castore app
==> esbuild
Compiling 4 files (.ex)
Generated esbuild app
==> tailwind
Compiling 3 files (.ex)
Generated tailwind app
==> mint
Compiling 1 file (.erl)
Compiling 20 files (.ex)
Generated mint app
==> finch
Compiling 14 files (.ex)
Generated finch app
==> websock
Compiling 1 file (.ex)
Generated websock app
==> bandit
Compiling 50 files (.ex)
Generated bandit app
==> swoosh
Compiling 51 files (.ex)
Generated swoosh app
==> websock_adapter
Compiling 4 files (.ex)
Generated websock_adapter app
==> phoenix
Compiling 71 files (.ex)
Generated phoenix app
==> phoenix_live_reload
Compiling 5 files (.ex)
Generated phoenix_live_reload app
==> phoenix_live_view
Compiling 39 files (.ex)
Generated phoenix_live_view app
==> phoenix_live_dashboard
Compiling 36 files (.ex)
Generated phoenix_live_dashboard app
==> phoenix_ecto
Compiling 7 files (.ex)
Generated phoenix_ecto app

If I understood you correctly this is what you have:

$ mix deps.compile
==> file_system
Compiling 7 files (.ex)
Generated file_system app
==> decimal
Compiling 4 files (.ex)
Generated decimal app
==> mime
Compiling 1 file (.ex)
Generated mime app
==> nimble_options
Compiling 3 files (.ex)
Generated nimble_options app
===> Analyzing applications...
===> Compiling telemetry
**(Mix) Could not compile dependency :telemetry, "escript rebar3 bare compile --paths _build/dev/lib/*/ebin" command failed. Errors may have been logged above. 
You can recompile this dependency with "mix deps.compile telemetry --force" or clean it with "mix deps.clean telemetry"

Is that correct?

Sry for taking so much time, was working here.

Yes, it’s that, it compiles all the previous dependencies until telemetry.

Oh, I never had such a case and now I’m interested. In normal case there should be something before, but if not then I guess there was something that Erlang VM does not handle (?). :thinking:

If we talk about a bug in some app written in Elixir then I agree, but if there is a problem in Erlang installation then it’s completely different topic since for example on Linux there are package managers and other tools, so it’s easy to ensure that all environment dependencies are met …

Let’s think:

  1. It’s not an general issue as in other OS it works without any problem
  2. It’s not a bug in all Windows installations as there would be more posts/likes/etc about it …
  3. Therefore it would make sense that something in your environment is not correct and since Elixir’s dependencies are compiling well it should be Erlang-related
  4. I guess that you have installed Erlang using installer on Erlang’s download page …

If we assume all above then there could be 2 possible issues:

  1. Broken Erlang installation (not really sure), so reinstalling it may fix the problem
  2. Newest telemetry package does not compile at all on your version and possibly also previous versions (25.x). Try updating Elang to latest 25.x i.e. 25.3.2.15 or install a newer version of it (27.1.1 is the latest one) - that would explain 2nd point in previous list

Generally it’s hard to tell how to fix it since we have no idea about issue (no warnings or errors that could give us a hint). Therefore unless you would find something we can only ask to do routine activities like removing _build directory or reinstall/update Erlang installation.

If you can diagnose the problem we may help you more. For example if the process is killed because of memory violation or stuff like that then we can go forward and detect if it’s a bug in Erlang or Elixir. So far we can’t tell you more unless there is someone who had the exact same issue …

Since it looks like it’s related to Erlang maybe you would have more luck if you reach out help on Erlang forum: Erlang Forums - Erlang Programming Language Forums

I installed them both (Elixir and Erlang) through Scoop and I know 80% Erlang isn’t (probably) broken bc I’ve been also using gleam for some time and it uses it.

I’ll try to reinstall both of them + clean some caches to see if it fixes it, thx.

Nope, same thing here, just reinstalled everything

Welp, I’ll try it out later in another computer, to see if the problem is local

Did you also try in Docker? And what about that full output of mix phx.server that was requested earlier?

I don’t use docker also installing docker for a programming language is just weird.

The output is like @Eiji showed, it compiles normally until telemetry.
Output: That’s like, the best I can do to show it, I can’t post images here.

Try running it with the environment DEBUG=1 and/or MIX_DEBUG=1.

The first potential issue I spotted is your usage of OTP-27 and elixir compiled with OTP-25, this can be a potential version mismatch.

The next thing to check is phx.new version, I would strongly recommend to to upgrade to the latest generator version and generate a new phoenix project, you can do that by running:

mix local.hex

# Press yes when it asks to override previous verion
mix archive.install hex phx_new

If that still yields no success, then you are most probably missing one of the OTP core libraries. How you are installing your OTP? If you are using kerl, asdf or alternatives you will compile OTP from source, but you will need to have the prerequisite compilation libraries in place to do be able to build OTP.

You should have a similar output if you are compiling from source:

Building Erlang/OTP 25.3 (asdf_25.3), please wait...
WARNING: It appears that a required development package 'libssl-dev' is not installed.
WARNING: It appears that a required development package 'libncurses5-dev' is not installed.
APPLICATIONS DISABLED (See: /home/lucas/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3/otp_build_25.3.log)
 * crypto         : No usable OpenSSL found
 * jinterface     : No Java compiler found
 * odbc           : ODBC library - link check failed
 * ssh            : No usable OpenSSL found
 * ssl            : No usable OpenSSL found

The only apps that you don’t really care being disabled are: wx, odbc, jinterface. If you have crypto listed there, you will be unable to launch a phoenix app, so check out for that too.

1 Like

Oh, that looks interesting …

O sistema não pode encontrar o caminho especificado

Here is a translated version:

The system cannot find the specified path

I would start investigating from here with DEBUG and MIX_DEBUG as previously suggested.


The next thing that catched my eye is last line before red message:

==> zaworld

which most likely is a name of author application. It would not be anything special if there would be no other dependencies left to compile (see my previous message how much it have skipped). Even if there is an environment issue the target application should be compiled last

Just to be sure I have tried to generate 2 apps called a and b. Firstly I have edited b/mix.exs by adding a dependency {:a, "~> 0.1", path: "../a"}. Secondly I put IO.inspectt(:hello_world) at the end of a/lib/a.ex file. Finally I have tried to compile b app and as expected there was no ==> b, see:

$ mix compile
==> a
Compiling 1 file (.ex)

== Compilation error in file lib/a.ex ==
** (UndefinedFunctionError) function IO.inspectt/1 is undefined or private. Did you mean:

      * inspect/1
      * inspect/2
      * inspect/3

    (elixir 1.17.3) IO.inspectt(:hello_world)
    lib/a.ex:20: (file)
    (elixir 1.17.3) lib/kernel/parallel_compiler.ex:429: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8
could not compile dependency :a, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile a --force", update it with "mix deps.update a" or clean it with "mix deps.clean a"

So the author have a very strange edge-case where:

  1. Many dependencies were skipped for some reason
  2. At least message about compilation of main app come way too soon
  3. The could not compile dependency … message happen after going to next step (after telemetry-related output, after skipping dependencies and after at least compilation start message of main app)

@josevalim Could it be a separate compiler/mix issue or maybe I have missed something?

1 Like

The “cannot find path” “error” is normal here and it happens with other application, it’s a shell/terminal problem, not an elixir problem (It happens when I open my editor, for example).

zaworld is the application name, like, the application it’s trying to build. Not any external one.

1 Like

How is that normal? Maybe it’s a persistent problem that you simply have not solved yet. Have you tracked it down to its source?

Finally, in order to arrive at a resolution, can you produce a small Git repo that demonstrates the problem?

1 Like

:+1:

In first post:

The command was most probably just:

mix phx.new zaworld

Yes, but there are other elements in the equation like the version of the phx_new generator, and we don’t know for sure if OP didn’t give any other options on the CLI.

I am asking because I just generated a new project and had no problem. But as @D4no0 pointed out, Elixir is 1.17.3 but compiled for Erlang 25, whereas the currently used Erlang on OP’s system is 27. That’s likely the actual problem. (I use Elixir 1.17.3 compiled for Erlang 27, plus I use Erlang 27.)

Just tested it. Using asdf I have compiled Erlang first 25.x stable release (25.0) and recompiled Elixir (ref:v1.17.3). Then I have switched back to Erlang latest stable version (27.1.1), generated new phoenix app and compiled dependencies. The output was clear and everything went without any issue.

For sure I’m not using Windows, but it’s not about old Erlang version always failing to build telemetry in every environment.

1 Like