beaver-lodge / beaver

MLIR Toolkit in Elixir and Zig.
MIT License
161 stars 8 forks source link

Error while trying to use Beaver on Windows #358

Open nofe1248 opened 1 month ago

nofe1248 commented 1 month ago

When I try to use Beaver in my project on Windows, I got following errors:

> iex.bat -S mix
Erlang/OTP 27 [erts-15.1] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [jit:ns]

==> beaver
could not compile dependency :beaver, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile beaver --force", update it with "mix deps.update beaver" or clean it with "mix deps.clean beaver"
** (FunctionClauseError) no function clause matching in Kinda.Precompiler.current_target/1

    The following arguments were given to Kinda.Precompiler.current_target/1:

        # 1
        {:win32, :nt}

    Attempted function clauses (showing 1 out of 1):

        def current_target({:unix, _})

    (kinda 0.9.2) Kinda.Precompiler.current_target/1
    (elixir_make 0.8.4) lib/elixir_make/artefact.ex:252: ElixirMake.Artefact.current_target_url/3
    (elixir_make 0.8.4) lib/mix/tasks/compile.elixir_make.ex:220: Mix.Tasks.Compile.ElixirMake.download_or_reuse_nif/3
    (elixir_make 0.8.4) lib/mix/tasks/compile.elixir_make.ex:165: Mix.Tasks.Compile.ElixirMake.run/1
    (mix 1.17.3) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.17.3) lib/mix/tasks/compile.all.ex:108: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.17.3) lib/mix/tasks/compile.all.ex:88: Mix.Tasks.Compile.All.compile/4
    (mix 1.17.3) lib/mix/tasks/compile.all.ex:62: Mix.Tasks.Compile.All.run/1

Also I've spotted the following code in Kinda:

  @impl ElixirMake.Precompiler
  def all_supported_targets(:fetch) do
    ~w(
      aarch64-apple-darwin
      x86_64-linux-gnu
    )
  end

Is Beaver doesn't support Windows?

jackalcooper commented 1 month ago

Is Beaver doesn't support Windows?

With some changes on Kinda and Beaver it should be possible to support Windows. The error you posted is about the absence of Windows prebuild of Beaver+LLVM/MLIR shared library. You can trigger a source build with system env BEAVER_BUILD_CMAKE=1 (it might fail for some other reasons)

Very welcome if you can send a PR to get Windows build working and we can make the prebuild as a regular one like those for Linux and macOS. You can also give me some more information about what kind of Windows setup you are running (like C/C++ compilers etc), so I can try to install and reproduce build failures.