Ash Compilation Error - File Name Too Long

Hello,

I recently started getting this error when compiling ash. I moved the project that was complaining to /src on my machine and it will compile there, however as I update the versions of Ash in my other projects I keep getting error below. I don’t think the folder prefix /home/tanner/src/file-manager/server is absurdly long. The problem starts happening in {:ash, "== 3.5.2"}, the projects will happily compile in 3.5.1, 3.5.0 and 3.4.X versions without getting moved.

I’m running on Linux Mint 22.1, I get the same error on WSL Ubuntu.

** (EXIT from #PID<0.95.0>) an exception was raised:
    ** (File.Error) could not write to file "/home/tanner/src/file-manager/server/_build/dev/lib/ash/ebin/Elixir.Ash.Domain.Dsl.Resources.Resource.Resources.Definitions.Define.Resources.Definitions.CustomInputs.CustomInput.Resources.Definitions.CustomInputs.Transform.Transform.beam": file name too long
        (elixir 1.18.1) lib/file.ex:1144: File.write!/3
        (elixir 1.18.1) lib/kernel/parallel_compiler.ex:332: anonymous fn/3 in Kernel.ParallelCompiler.write_module_binaries/3
        (elixir 1.18.1) lib/enum.ex:1276: anonymous fn/3 in Enum.flat_map/2
        (stdlib 6.2) maps.erl:860: :maps.fold_1/4
        (elixir 1.18.1) lib/enum.ex:2558: Enum.flat_map/2
        (elixir 1.18.1) lib/kernel/parallel_compiler.ex:264: Kernel.ParallelCompiler.spawn_workers/3
        (mix 1.18.1) lib/mix/compilers/elixir.ex:1079: anonymous fn/9 in Mix.Compilers.Elixir.compiler_loop/6

Since you mentioned WSL, you are using windows as your main OS?

Windows is known for having nested folder size limitations, some of them you can overcome by overriding specific registry entries, but there is still a hard limit. I think the first thing to check is that the path to the WSL volumes is not long, you might want to keep it as short as possible.

@thawke spark is our underlying DSL builder tool, and it creates modules under the hood. It was creating unnecessarily long module names. Can you try main of spark via {:spark, "ash-project/spark", override: true} and LMK if that helps?

3 Likes

@D4no0 My main OS is Linux Mint 22.1, however I have encryptfs on my home directory which does cut out some available path length. WSL I’m assuming has the same issue due to Windows path limitations.

@zachdaniel Using :ash 3.5.6, :ash_postgres 2.5.16, :ash_cloak 0.1.6 and {:spark, git: "https://github.com/ash-project/spark", override: true} I still get the really long name Elixir.Ash.Domain.Dsl.Resources.Resource.Resources.DefineCalculation.Resources.CustomInputs.CustomInput.Resources.CustomInputs.Transform.Transform.beam

:thinking: what SHA is locked for spark in your mix.lock file? Might be worth checking again w/ mix deps.update spark just to be sure you’re on latest. I was able to confirm the long module names were gone for me. Its possible we missed a case, just want to make sure I’m not going on a wild goose chase.

spark in the mix.lock file is "spark": {:git, "https://github.com/ash-project/spark", "2ea8dd6d2e9d9e1f1bd129af88da1a23ea885b02", []} which looks like it’s the latest commit on master.

If I run mix new test_project and set in mix.exs:

  defp deps do
    [
      {:ash, "== 3.5.6"},
      {:spark, git: "https://github.com/ash-project/spark", override: true}
    ]
  end

and run mix deps.get and mix deps.compile I still get Ash.Domain.Dsl.Resources.Resource.Resources.DefineCalculation.Resources.CustomInputs.CustomInput.Resources.CustomInputs.Transform.Transform.Options printed which writes to Elixir.Ash.Domain.Dsl.Resources.Resource.Resources.DefineCalculation.Resources.CustomInputs.CustomInput.Resources.CustomInputs.Transform.Transform.Options.beam

I reproduced the above on Windows, Mint and WSL, all running elixir 18.x.

What happens if you rm -rf _build and recompile?

nvm, I reproduced it, you’re right :slight_smile:

Okay, try again :smiley:

Latest version works well! (spark module at commit 64e384b) Thanks for your time, much appreciated.

1 Like

Fix published on hex as version 2.2.52

1 Like