burrito: Generated application "hangs"

Host

Tell us about your Host OS (the machine you’re building burrito apps on)

Host OS: macOS 13.6.1 Host CPU: M2 Max

Please run zig version in your Burrito project directory and write the version here: 0.11.0

Please run elixir -v in your Burrito project directory and write the version here: Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.16.0 (compiled with Erlang/OTP 26)

Target

Host OS: macOS 13.6.1 Host CPU: M2 Max Host LibC and Version: N/A


I’m building a CLI app, which maybe isn’t the common use case for Burrito?

My issue is that the compiled macOS binary doesn’t seem to be invoking my start function.

Here’s the relevant chunk of mix.exs

def application do
  case System.get_env("BUILD_MODE") do
    "burrito" ->
      IO.puts("COMPILING FOR BURRITO")
      [
        mod: {Rez, []},
        extra_applications: [:logger, :eex, :crypto, :iex, :tools]
      ]

    _ ->
      IO.puts("COMPILING FOR ESCRIPT")
      [
        extra_applications: [:logger, :eex, :crypto, :iex, :tools]
      ]
  end
end

I can see “COMPILING FOR BURRITO” when it compiles (funnily enough I also see COMPILING FOR ESCRIPT first??). Here’s the build output:

build_out.txt

In rez.ex

defmodule Rez do
  def start(_, _) do
    IO.puts("IN START")

    Burrito.Util.Args.get_arguments()
    |> real_args()
    |> run_command(:halt)
  end
end

I execute burrito_out/rez_macos sometimes I get a huge amount of output (in the stdlog.out attached) but either way I don’t see the ‘IN START’ output anyway.

Then the app hangs at that point until I use ^C^C to kill the Beam.

stdout.log

I’m a bit stuck. Any suggestions about what I could look into?

Many thanks in advance.

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

Hey @doawoo I’ve just pushed the 1.1.6 version so all up to date with my local working copy. My dep is on the 1.0 official release from Hex.pm. My build script is:

BUILD_MODE=burrito BURRITO_TARGET=macos MIX_ENV=prod mix compile
BUILD_MODE=burrito BURRITO_TARGET=macos MIX_ENV=prod mix release --overwrite

It builds, then I run the binary:

burrito_out/res_macos --version

I don’t get any output. I have to ^c^c to get back to the shell.

I’m sure it’s something I’ve messed up, but I just can’t see it.