相关文章推荐
英姿勃勃的白开水  ·  Delphi ...·  2 月前    · 
打盹的板栗  ·  java.lang.AbstractMeth ...·  2 月前    · 
不爱学习的跑步机  ·  Django forms ...·  12 月前    · 

Hey guys,
I just installed Elixir 1.10 on my Arch Linux and I am starting to learn this nice language.
I am experiencing some problems with my compiler.
I created a new project:

mix new cards

This worked fine. The project was created. However after I make a change to the .ex file in the lib folder and save it and then type recompile iex returns :noop. Oddly enough if I do:

recompile force: true

Then it works fine and the new code is compiled and accessible.
I get the same behavior with mix. ‘mix compile --force’ works but ‘mix compile’ doesn’t output anything.
Yes I made sure that I made and saved changes to the file before trying to recompile and I made sure I am in my project when trying to recompile. Any ideas?

System:
Arch Linux
FS: ext4 mounted on /
Not a virtual machine

You are correct, I am just wondering if that might be related. But most likely I am wrong.

Another thing that comes to mind that your FS has mtime disabled?

As mix relies solely on the files timestamp, could you please check if the mtime is updated on write?

Perhaps check fstab how you mount that drive.

Also make sure to look at the correct mount.

For me, that’s about an hour in the future :smiley:

Also please do not post screenshots. Instead copy and paste into the forum and use markdown code fences to mark your code.

For me, the following workflow triggers a rebuild, does it for you as well?

$ mix compile
$ touch lib/foo.ex
$ mix compile

Also, what editor are you using? Does it perhaps recompile on save? Vim with some “ale” plugin was known to cause exactly this kind of problems.

I am from the future, ask me anything.

I am using Atom, it definitely doesn’t compile on save in my case.
However I did install a bunch of Elixir packages. Maybe I should remove them and try again?

mix compile doesn’t do anything for me. ‘mix compile --force’ works.

So assuming you have closed your editor (atom had similar problems with some plugins AFAIK) and used the touch trick, and still there happens no recompilation?

That’s really weird, can you show the full transcript of trying it?

By the way here’s what I discovered:
If there are no errors in the code recompile returns :noop but if I write some random string and then do recompile I get errors:

iex(42)>  recompile
:noop
iex(43)>  recompile
:noop
iex(44)>  recompile
:noop
iex(45)>  recompile
:noop
iex(46)>  recompile
Compiling 1 file (.ex)
warning: variable "gababsdahsadh" does not exist and is being expanded to "gababsdahsadh()", please use parentheses to remove the ambiguity or change the variable name
  lib/cards.ex:41: Cards
== Compilation error in file lib/cards.ex ==
** (CompileError) lib/cards.ex:41: undefined function gababsdahsadh/0
** (exit) shutdown: 1
    (mix 1.10.1) lib/mix/tasks/compile.all.ex:62: Mix.Tasks.Compile.All.do_compile/4
    (mix 1.10.1) lib/mix/tasks/compile.all.ex:27: anonymous fn/2 in Mix.Tasks.Compile.All.run/1
    (mix 1.10.1) lib/mix/tasks/compile.all.ex:43: Mix.Tasks.Compile.All.with_logger_app/2
    (mix 1.10.1) lib/mix/task.ex:330: Mix.Task.run_task/3
    (mix 1.10.1) lib/mix/tasks/compile.ex:96: Mix.Tasks.Compile.run/1
    (mix 1.10.1) lib/mix/task.ex:330: Mix.Task.run_task/3
    (iex 1.10.1) lib/iex/helpers.ex:104: IEx.Helpers.recompile/1
iex(46)> 

This means something is going on after all.

I did remove some Atom autocomplete-elixir package that was giving out an error. ‘recompile’ seems to be working fine now:

iex(46)>  recompile
Compiling 1 file (.ex)
warning: variable "muff" is unused (if the variable is not meant to be used, prefix it with an underscore)
  lib/cards.ex:41: Cards.bro/2
iex(47)>

Thanks guys!