[outline: INTRO, EVIDENCE, EXPLANATION, WORK-AROUND?]
INTRO: I noticed the error flag in VS Code this morning after I started my computer. It was not there yesterday when I stopped. I believe there is a naming conflict between Gettext.beam and GetText.beam. I use VS Code on Windows 10. I committed my changes in my ‘web_eme_frequency’ app this morning and haven’t touched my ‘get_text’ app in a few days.
It looks like assets from my get_text app have been leaked into the beam file loading for the web_eme_frequency app. The web_eme_frequency app has no direct, nor indirect, dependencies on the get_text app. (Although I’d like to be able to add those in the future.)
EVIDENCE: Here is the output from ‘mix compile’ following ‘mix clean’:
$ mix compile
==> morph
Compiling 2 files (.ex)
Generated morph app
==> eme_ecto
Compiling 4 files (.ex)
Generated eme_ecto app
==> get_text
Compiling 2 files (.ex)
07:15:29.690 [error] beam/beam_load.c(1433): Error loading module ‘Elixir.GetText’:
BEAM file exists but it defines a module named Elixir.Gettext
07:15:29.690 [error] Loading of c:/Users/at7wa/NoneDrive/dev/eme-frequency/_build/dev/lib/gettext/ebin/Elixir.GetText.beam failed: :badfile
Generated get_text app
==> web_eme_frequency
Compiling 14 files (.ex)
07:15:30.538 [error] beam/beam_load.c(1433): Error loading module ‘Elixir.Gettext’:
BEAM file exists but it defines a module named Elixir.GetText
07:15:30.538 [error] Loading of c:/Users/at7wa/NoneDrive/dev/eme-frequency/_build/dev/lib/get_text/ebin/Elixir.Gettext.beam failed: :badfile
07:15:31.686 [error] beam/beam_load.c(1433): Error loading module ‘Elixir.Gettext’:
BEAM file exists but it defines a module named Elixir.GetText
07:15:31.686 [error] Loading of c:/Users/at7wa/NoneDrive/dev/eme-frequency/_build/dev/lib/get_text/ebin/Elixir.Gettext.beam failed: :badfile
== Compilation error in file lib/web_eme_frequency/gettext.ex ==
** (CompileError) lib/web_eme_frequency/gettext.ex:23: module Gettext is not loaded and could not be found
(elixir) expanding macro: Kernel.use/2
lib/web_eme_frequency/gettext.ex:23: WebEmeFrequency.Gettext (module)
EVIDENCE: The gettext files in my _build directory are:
./_build/dev/lib/gettext/ebin/Elixir.Gettext.beam
./_build/dev/lib/gettext/ebin/Elixir.Mix.Tasks.Compile.Gettext.beam
./_build/dev/lib/get_text/ebin/Elixir.GetText.beam
EXPLANATION: I have an umbrella project: eme-frequency–to get information about graphemes, phonemes, morphemes (I tutor dyslexics and do recreational programming).
The umbrella project has four apps: eme_ecto, get_text, morph, and web_eme_frequency. (It will probably have two more – graph and phon…)
web_eme_frequency is the latest, generated with mix phx.new.web. One of the phoenix dependencies is gettext. Apparently due to windows case insensitivity, Gettext.beam and GetText.beam get confused.
This shouldn’t happen from my point of view, first because it was not a problem yesterday, second because the dependency trees are clean with respect to gettext and get_text, and as noted above my actions have been in the web_eme_frequency app, in the …/live/ and …/templates/*/ directories.
WORK-AROUND?
At this point, my five decades of experience tell me there is enough sufficiently advanced technology in mix, elixir, phoenix, and erlang, and I should “simply” rename my get_text app and resources. And then run ‘mix do clean, compile’. Is it that simple? Has anyone listed all the touch points when renaming an app in an umbrella project? (quick search in elixir forum yielded nothing obvious to me.)
OTOH, is there a simple configuration change that will make the loader for the web_eme_frequency app use only the dependencies in that app? The web_eme_frequency app’s dependencies are eme_ecto (in_umbrella: true) and the standard phoenix dependencies. The eme_ecto dependencies are as expected for using postgresql and do not include get_text.