Skip to content

Elixir package support does not work on Windows #1773

@mtnbnz

Description

@mtnbnz

The recent addition of support for Elixir packages in Gleam 0.23 does not work on Windows.
Attempting to compile a project that depends on tzdata gives the following:

PS C:\Users\dev\projects\test> gleam build
  Resolving versions
Downloading packages
 Downloaded 11 packages in 0.11s
  Compiling certifi
===> Analyzing applications...
===> Compiling certifi
  Compiling parse_trans
===> Analyzing applications...
===> Compiling parse_trans
  Compiling unicode_util_compat
===> Analyzing applications...
===> Compiling unicode_util_compat
  Compiling ssl_verify_fun
error: Program not found

The program `elixir` was not found. Is it installed?

The issue, I believe, is that the invoking Elixir is currently hardcoded to invoking elixir, while on Windows it should be done via elixir.bat.
However, fixing this in the compiler gives the following error:

  Compiling ssl_verify_fun
DEBUG writing_elixir_paths_to_build
DEBUG command_exec program="elixir.bat" args="--eval File.write!(\"gleam_elixir_paths\", [:eex, :elixir, :logger, :mix] |> Stream.map(fn(lib) -> lib |> :code.lib_dir |> Path.expand end) |> Enum.join(\"\\n\"))" env=[("TERM", "dumb")] cwd=Some("build\\dev\\erlang")
** (SyntaxError) nofile:1:38: unexpected token: ]
    |
  1 | File.writeeex, :elixir, :logger, :mix] |> Stream.map(fn(lib) -> lib |> :code.lib_dir |> Path.expand end) |> Enum.join(\\n\))
    |                                      ^
    (elixir 1.13.3) lib/code.ex:403: Code.validated_eval_string/3
DEBUG reading_file path="build\\dev\\erlang\\gleam_elixir_paths"
DEBUG removing_failed_build package=ssl_verify_fun
DEBUG deleting_directory path="build\\dev\\erlang\\ssl_verify_fun"
DEBUG directory_did_not_exist_for_deletion path="build\\dev\\erlang\\ssl_verify_fun"
ERROR Failed error=FileIo { kind: File, action: Read, path: "build\\dev\\erlang\\gleam_elixir_paths", err: Some("The system cannot find the file specified. (os error 2)") }
error: File IO failure

An error occurred while trying to read this file:

    build\dev\erlang\gleam_elixir_paths

My guess is it has something to do with the way command-line arguments are passed to elixir.bat that has to be done differently on Windows than on Unix-like operating systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedContributions encouraged

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions