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

Mix compile goes to error because of invoking module rebar_utils functions in rebar.config.script #2189

Closed
jsvisa opened this issue Apr 24, 2014 · 4 comments

Comments

@jsvisa
Copy link
Contributor

jsvisa commented Apr 24, 2014

When use a Erlang dependence druuid in Elixir, which module uses rebar to compile, and in the rebar.config.script, it invoke a function rebar_utils:is_arch/ defined in module rebar_utils to diff the platform. That module can be compiled successfully in Erlang, otherwise in Elixir, and it turns out the the following error:

Error evaluating rebar config script ./rebar.config.script: 27: evaluation failed with reason error:undef and stacktrace [{rebar_utils,is_arch,[[98,115,100]],[]},{erl_eval,do_apply,6,[{file,[101,114,108,95,101,118,97,108,46,101,114,108]},{line,657}]},{erl_eval,expr,5,[{file,[101,114,108,95,101,118,97,108,46,101,114,108]},{line,272}]},{file,eval_stream2,6,[{file,[102,105,108,101,46,101,114,108]},{line,1376}]},{file,script,2,[{file,[102,105,108,101,46,101,114,108]},{line,1077}]},{'Elixir.File','cd!',2,[{file,[108,105,98,47,102,105,108,101,46,101,120]},{line,1001}]},{'Elixir.Mix.Rebar',eval_script,2,[{file,[108,105,98,47,109,105,120,47,114,101,98,97,114,46,101,120]},{line,133}]},{'Elixir.Mix.Dep.Loader','-rebar_dep/1-fun-0-',2,[{file,[108,105,98,47,109,105,120,47,100,101,112,47,108,111,97,100,101,114,46,101,120]},{line,210}]}] Any dependency defined in the script won't be available unless you add them to your Mix project

In my opinion, in Elixir side, it doesn't export rebar_utils module, so it returns error when invoke file:script/2 in Mix.Rebar.eval_script/2

@josevalim
Copy link
Member

Yeah, that's a bug. Thanks. Although there isn't much we can do, which sucks.

@ericmj do you have any solution in mind? Maybe we should warn saying we could not evaluate the rebar script and say that any dependency in the script is not going to be fetched?

@jsvisa
Copy link
Contributor Author

jsvisa commented Apr 24, 2014

I have an solution, we can add rebar as one of Mix dependence, and export the modules associated with rebar, although it doesn't sounds very well.

@josevalim
Copy link
Member

Yeah, having rebar as a dependency would work, but it doesn't look like the best idea.

@josevalim
Copy link
Member

I just checked with @ericmj and indeed there is nothing to do rather than adding rebar as a dependency to your project.

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

No branches or pull requests

2 participants