Phoenix: New project compiles with 'undef' error

Created on 4 Aug 2017  路  5Comments  路  Source: phoenixframework/phoenix

Environment

  • Elixir version (elixir -v): Elixir 1.4.2
  • Phoenix version (mix deps): 1.3.0 (phoenix) 1c01124c
  • Operating system: Alpine

Expected behavior

Compile the project

Actual behavior

/app # DEBUG=1 mix deps.compile
===> Expanded command sequence to be run: []
===> Expanded command sequence to be run: [{default,app_discovery},
                                           {bare,compile}]
===> Compiling fs
===> run_hooks("/app/deps/fs", pre_hooks, compile) -> no hooks defined

===> run_hooks("/app/deps/fs", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["/app/deps/fs/src/sys/inotifywait_win32.erl",
                       "/app/deps/fs/src/sys/inotifywait.erl",
                       "/app/deps/fs/src/sys/fsevents.erl",
                       "/app/deps/fs/src/fs_sup.erl",
                       "/app/deps/fs/src/fs_server.erl",
                       "/app/deps/fs/src/fs_event_bridge.erl",
                       "/app/deps/fs/src/fs_app.erl",
                       "/app/deps/fs/src/fs.erl"]
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: undef
===> Stack trace to the error location:
[{erl_syntax,type,[{attribute,1,module,inotifywait_win32}],[]},
 {rebar_erlc_compiler,parse_attrs,3,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,654}]},
 {rebar_erlc_compiler,modify_erlcinfo,5,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,462}]},
 {rebar_erlc_compiler,'-update_erlcinfo_fun/2-fun-0-',4,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,447}]},
 {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
 {rebar_erlc_compiler,init_erlcinfo,4,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,395}]},
 {rebar_erlc_compiler,compile_dirs,5,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,195}]},
 {rebar_erlc_compiler,compile,2,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,121}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
** (Mix) Could not compile dependency :fs, "/root/.mix/rebar3 bare compile --paths "/app/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile fs", update it with "mix deps.update fs" or clean it with "mix deps.clean fs"

Most helpful comment

Hi Jose,

Yes, that's exactly what happened. Seems like alpine linux doesn't install all needed packages for the phoenix to work, I needed to install : erlang-parsetools erlang-tools erlang-syntax-tools erlang-runtime-tools

Thanks for your help.

All 5 comments

This is an issue building fs, which is used by phoenix_live_reload. In the interesting of getting you unstuck, you can remove phoenix_live_reload from your deps, then remove the following two lines from your endpoint.ex:

socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader

This should allow you to build your project while diagnosing the fs build issue. What erl version are you on? You could also try bumping rebar with mix local.rebar.

I'm on Erlang/OTP 19 [erts-8.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]

ok, it's somehow better, but now I got a problem compiling ranch:

Generated gettext app
===> Expanded command sequence to be run: []
===> Expanded command sequence to be run: [{default,app_discovery},
                                           {bare,compile}]
===> Compiling ranch
===> run_hooks("/app/deps/ranch", pre_hooks, compile) -> no hooks defined

===> run_hooks("/app/deps/ranch", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info]
===> files to compile ["/app/deps/ranch/src/ranch_transport.erl",
                       "/app/deps/ranch/src/ranch_tcp.erl",
                       "/app/deps/ranch/src/ranch_sup.erl",
                       "/app/deps/ranch/src/ranch_ssl.erl",
                       "/app/deps/ranch/src/ranch_server.erl",
                       "/app/deps/ranch/src/ranch_protocol.erl",
                       "/app/deps/ranch/src/ranch_listener_sup.erl",
                       "/app/deps/ranch/src/ranch_conns_sup.erl",
                       "/app/deps/ranch/src/ranch_app.erl",
                       "/app/deps/ranch/src/ranch_acceptors_sup.erl",
                       "/app/deps/ranch/src/ranch_acceptor.erl",
                       "/app/deps/ranch/src/ranch.erl"]
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: undef
===> Stack trace to the error location:
[{erl_syntax,type,[{attribute,15,module,ranch_transport}],[]},
 {rebar_erlc_compiler,parse_attrs,3,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,654}]},
 {rebar_erlc_compiler,modify_erlcinfo,5,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,462}]},
 {rebar_erlc_compiler,'-update_erlcinfo_fun/2-fun-0-',4,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,447}]},
 {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
 {rebar_erlc_compiler,init_erlcinfo,4,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,395}]},
 {rebar_erlc_compiler,compile_dirs,5,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,195}]},
 {rebar_erlc_compiler,compile,2,
                      [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_erlc_compiler.erl"},
                       {line,121}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
==> web
** (Mix) Could not compile dependency :ranch, "/root/.mix/rebar3 bare compile --paths "/app/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile ranch", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"
The command '/bin/sh -c cd /app && DEBUG=1 mix deps.compile' returned a non-zero code: 1

Is it possible that your operating system breaks Erlang into multiple packages and one of those packages are missing? erl_syntax is in the system_tools application in Erlang and some of operating systems put that into an erlang_system_tools package or something of sorts.

Hi Jose,

Yes, that's exactly what happened. Seems like alpine linux doesn't install all needed packages for the phoenix to work, I needed to install : erlang-parsetools erlang-tools erlang-syntax-tools erlang-runtime-tools

Thanks for your help.

Was this page helpful?
0 / 5 - 0 ratings