setup icon indicating copy to clipboard operation
setup copied to clipboard

Setup fails to build as hex dep of mix

Open fishcakez opened this issue 8 years ago • 6 comments

Setup fails to build when used as a hex dependency in mix and compiled with rebar3 bare compiler. It can be compiled with rebar 2.6.2 from mix. The error with the following versions Erlang/OTP 20.0.4, Rebar 3.3.6 and Elixir 1.5.1, Setup 1.8.4 is:

./rebar skip_deps=true escriptize                                                                                                                   
make: ./rebar: No such file or directory                                                                                     
make: *** [escriptize] Error 1                                                                
===> Hook for compile failed!                                                     
                                                                                    
** (Mix) Could not compile dependency :setup, "/.mix/rebar3 bare compile --paths "/code/elixometer/_build/test/lib/*/ebin"" 
command failed. You can recompile this dependency with "mix deps.compile setup", update it with "mix deps.update setup" or clean it with "mix deps.c
lean setup"

fishcakez avatar Oct 18 '17 00:10 fishcakez

Can confirm this is still a problem.

isaacsanders avatar Dec 06 '17 20:12 isaacsanders

Still an issue with escriptize :/ With Elixir 1.6.5 on OTP 20 adding exomoter (master branch) pulls in setup, which fails with this:

===> Compiling setup
===> Unable to run post hooks for 'compile', command 'escriptize' not found.
** (Mix) Could not compile dependency :setup, "rebar3 bare compile --paths "<<PROJECT BASE 
PATH>>/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix 
deps.compile setup", update it with "mix deps.update setup" or clean it with "mix deps.clean setup"

Running rebar3 escriptize in the deps/setup dir manually appears to work fine. As can be seen above, however, it tries to escriptive all (!) files in _build/{MIX_ENV}/lib/*/ebin .. when it runs in a bare and minimal project, there are no such files and it fails.

For now I am just commenting out the escriptize call in rebar.config, but that is probably not a good long term solution ;)

aseigo avatar May 17 '18 09:05 aseigo

The problem is that it looks for rebar in path: https://github.com/uwiger/setup/blob/master/Makefile#L3 but it cannot find

ludwikbukowski avatar Aug 22 '18 10:08 ludwikbukowski

Adding this override:

{:setup, "1.8.4", override: true, manager: :rebar, runtime: false}

and manually editing your mix.lock:

"setup": {
  :hex, 
  :setup, 
  "1.8.4",
  "738db0685dc1741f45c6a9bf78478e0d5877f3d0876c0b50fd02f0210edb5aa4",
  [:rebar3],
  [],
  "hexpm"
},

# becomes

"setup": {
  :hex, 
  :setup, 
  "1.8.4",
  "738db0685dc1741f45c6a9bf78478e0d5877f3d0876c0b50fd02f0210edb5aa4",
  [:rebar],
  [],
  "hexpm"
},

seems to fix this for now. However, like @ludwikbukowski says the solution is for the Makefile to look for rebar differently, as it is installed and does exist in .mix (but I'm not sure how it could be fixed).

nihalgonsalves avatar Aug 22 '18 10:08 nihalgonsalves

Keeping this open, awaiting new information on how to best resolve this. Feedback welcome.

uwiger avatar Mar 15 '21 09:03 uwiger

This works for me with Elixir v1.10 and the following line in mix.lock.

  "setup": {:hex, :setup, "2.0.2", "1203f4cda11306c2e34434244576ded0a7bbfb0908d9a572356c809bd0cdf085", [:rebar3], [], "hexpm", "7d6aaf5281d0b0c40980e128f9dc410dacd03799a8577201d4c8b43e7f97509a"},

tolbrino avatar Mar 15 '21 09:03 tolbrino