Unexpected :noop after 'recompile' (mix / iex)

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

Do you have the inotify-tools Arch package installed?

Nope. Should I install it?

Inotify-tools shouldn’t be required for mix compile to detect a change, should it? I thought it was only for hot recompiles for phoenix

1 Like

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.

It’s the ext4 partition

That fstab looks fine, at least your /.

I assume you have your project somewhere in ~?

Small side note about mounting below /mnt per fstab. /mnt is meant for temporary mounts.

Yeah the project is in my home folder.
Didn’t know mnt was for temp only, I will fix it someday.

So change one of the Elixir source files (through your editor) and check if its modification time has changed?

Doesn’t this mean mtime is working:
image

Well, give us the output of ls -l of the Elixir source file you modified with your editor. “Today” might mean 20 hours ago as well.

image

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.

1 Like

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?

1 Like

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.

Think we should backtrack. How did you install Elixir?

I’d recommend installing both Erlang and Elixir through asdf and use that.

This indeed supports my editor theory.

Please do as I said and try provide transcript of compile, touch, compile with all editors closed.

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

:ok
iex(47)>

Thanks guys!

2 Likes