KrzysiekJ / abci_server

An application that allows writing ABCI servers.
Other
37 stars 3 forks source link

Upgrading to GNU Make 4 causes `Error Could not start application ranch: could not find application file: ranch.app` #4

Open ltfschoen opened 6 years ago

ltfschoen commented 6 years ago

I was getting the warning erlang.mk:26: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html whenever I ran iex -S mix after adding the abci_server dependency in mix.exs had been installed with mix deps.get

So I updated Erlang to v9.2 erl --version and Make from GNU Make 3.81 to GNU Make 4.2.1 make --version

But when I tried to run IEx it gives me the following error (Mix) Could not start application ranch: could not find application file: ranch.app

$ iex -S mix
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

 GEN    clean-app
 GEN    coverdata-clean
 DEP    gpb
 DEP    ranch
make[1]: Entering directory '/Users/Ls/code/blockchain/tendermint-elixir/blockchain_tendermint/deps/abci_server/deps/gpb'
Generating include/gpb_version.hrl...
mkdir -pv ebin
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_analyzer.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_codegen.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_codemorpher.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_compile.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_decoders.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_encoders.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_introspect.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_mergers.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_nif.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_translators.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_types.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_verifiers.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_lib.erl
erlc -o src src/gpb_parse.yrl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_parse.erl
erlc -o src src/gpb_scan.xrl
build/prepend_edoc_autogenerated "src/gpb_scan.erl" "src/gpb_scan.xrl"
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_scan.erl
Proto-compiling the description definition...
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin descr_src/gpb_compile_descr.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin descr_src/gpb_descriptor.erl
Generating ebin/gpb.app...
make[1]: Leaving directory '/Users/Ls/code/blockchain/tendermint-elixir/blockchain_tendermint/deps/abci_server/deps/gpb'
make[1]: Entering directory '/Users/Ls/code/blockchain/tendermint-elixir/blockchain_tendermint/deps/abci_server/deps/ranch'
 DEPEND ranch.d
 ERLC   ranch.erl ranch_acceptor.erl ranch_acceptors_sup.erl ranch_app.erl ranch_conns_sup.erl ranch_listener_sup.erl ranch_protocol.erl ranch_server.erl ranch_ssl.erl ranch_sup.erl ranch_tcp.erl ranch_transport.erl
 APP    ranch
make[1]: Leaving directory '/Users/Ls/code/blockchain/tendermint-elixir/blockchain_tendermint/deps/abci_server/deps/ranch'
 DEPEND abci_server.d
 ERLC   abci.erl abci_app.erl abci_server.erl abci_server_sup.erl
Old inliner: threshold=0 functions=[{'erlang_++',3},
                                    {lists_reverse,2},
                                    {cons,3},
                                    {id,2}]
 APP    abci_server
Compiling 1 file (.ex)
Generated blockchain_tendermint app
** (Mix) Could not start application ranch: could not find application file: ranch.app

If I close IEx and run IEx again, each time it still shows the error (Mix) Could not start application ranch: could not find application file: ranch.app

$ iex -S mix
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Compiling 1 file (.ex)
Generated blockchain_tendermint app
** (Mix) Could not start application ranch: could not find application file: ranch.app

If I remove the abci_server dependency from mix.exs, and remove installed dependencies rm -rf deps, and then reinstalled just other dependencies with mix deps.get (without abci_server), and then run IEX with iex, then IEx loads successfully.

$ iex -S mix
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

==> merkle_tree
Compiling 5 files (.ex)
Generated merkle_tree app
==> blockchain_tendermint
Compiling 1 file (.ex)
Generated blockchain_tendermint app
Interactive Elixir (1.6.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 

System:

ltfschoen commented 6 years ago

I fixed the error. After installing abci_server's dependencies using Mix with mix deps.get, I found ranch in the folder deps/abci_server/deps/ranch, which has a file makefile that contains the version of Ranch 1.3.2 that is installed as a dependency by abci_server.

I then searched the web and came across the Ranch Github repo https://github.com/ninenines/ranch, and I checked their Releases/Tags https://github.com/ninenines/ranch/tags, and found that their latest Tag is 1.4.0, so I figured that GNU Make 4 may be dependency on this, whereas GNU Make 3 was happy with the previous version of Ranch 1.3.2.

So I crossed updated mix.exs with the following:

defp deps do
  [
    {:abci_server, git: "https://github.com/KrzysiekJ/abci_server.git", tag: "v0.4.0"},
    {:ranch, git: "https://github.com/ninenines/ranch.git", tag: "1.4.0"}
  ]
end

And then reinstalled the Mix dependencies with mix deps.get

And finally tried running IEx to see if this had resolved the error, which it had!!

$ iex -S mix
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

 GEN    clean-app
 GEN    coverdata-clean
 DEPEND ranch.d
 ERLC   ranch.erl ranch_acceptor.erl ranch_acceptors_sup.erl ranch_app.erl ranch_conns_sup.erl ranch_listener_sup.erl ranch_protocol.erl ranch_server.erl ranch_ssl.erl ranch_sup.erl ranch_tcp.erl ranch_transport.erl
 APP    ranch
Compiling 1 file (.ex)
Generated blockchain_tendermint app
Interactive Elixir (1.6.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 

So I think we need to update https://github.com/KrzysiekJ/abci_server/blob/master/Makefile#L8, so the code changes to dep_ranch = git https://github.com/ninenines/ranch 1.4.0

I just tried manually changing that file in my deps/abci_server/Makefile to dep_ranch = git https://github.com/ninenines/ranch 1.4.0, and then I ran make tests and the tests are passing, so I'll create a Pull Request with that change

$ make tests
 GEN    clean-app
 GEN    coverdata-clean
 DEP    gpb
 DEP    ranch
make[1]: Entering directory '/Users/Ls/code/blockchain/tendermint-elixir/blockchain_tendermint/deps/abci_server/deps/gpb'
Generating include/gpb_version.hrl...
mkdir -pv ebin
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_analyzer.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_codegen.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_codemorpher.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_compile.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_decoders.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_encoders.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_introspect.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_mergers.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_nif.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_translators.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_types.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_gen_verifiers.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_lib.erl
erlc -o src src/gpb_parse.yrl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_parse.erl
erlc -o src src/gpb_scan.xrl
build/prepend_edoc_autogenerated "src/gpb_scan.erl" "src/gpb_scan.xrl"
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin src/gpb_scan.erl
Proto-compiling the description definition...
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin descr_src/gpb_compile_descr.erl
erlc -Wall +debug_info -Iinclude -pa ebin -o ebin descr_src/gpb_descriptor.erl
Generating ebin/gpb.app...
make[1]: Leaving directory '/Users/Ls/code/blockchain/tendermint-elixir/blockchain_tendermint/deps/abci_server/deps/gpb'
make[1]: Entering directory '/Users/Ls/code/blockchain/tendermint-elixir/blockchain_tendermint/deps/abci_server/deps/ranch'
 DEPEND ranch.d
 ERLC   ranch.erl ranch_acceptor.erl ranch_acceptors_sup.erl ranch_app.erl ranch_conns_sup.erl ranch_listener_sup.erl ranch_protocol.erl ranch_server.erl ranch_ssl.erl ranch_sup.erl ranch_tcp.erl ranch_transport.erl
 APP    ranch
make[1]: Leaving directory '/Users/Ls/code/blockchain/tendermint-elixir/blockchain_tendermint/deps/abci_server/deps/ranch'
 DEPEND abci_server.d
 ERLC   abci.erl abci_app.erl abci_server.erl abci_server_sup.erl
Old inliner: threshold=0 functions=[{'erlang_++',3},
                                    {lists_reverse,2},
                                    {cons,3},
                                    {id,2}]
 APP    abci_server
make[1]: Nothing to be done for 'test-dir'.
 GEN    test-build
 GEN    eunit
  All 7 tests passed.
KrzysiekJ commented 6 years ago

make --version on my system returns “GNU Make 4.2.1”, so I highly doubt that the issue is related to Make version. There are not many changes between ranch 1.3.2 and ranch 1.4.0.

ltfschoen commented 6 years ago

Based on your feedback I've modified Pull Request https://github.com/KrzysiekJ/abci_server/pull/3/files and removed the proposed change to the abci_server's Makefile so it still uses Ranch 1.3.2. The Pull Request only proposes to modify the Readme and includes a Troubleshooting section that may help other users who encounter the IEx error (Mix) Could not start application ranch: could not find application file: ranch.app by suggesting that they try adding Ranch 1.4.0 to their Mix dependencies.

KrzysiekJ commented 6 years ago

Is it reproducible reproducible that upgrading Ranch fixes the problem