GetFirefly/firefly

Not compiling the erlang.org hello world

lawik opened this issue · 5 comments

lawik commented

Same error for these two variants:

-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("hello, world\n").
-module(hello).
-export([hello_world/0]).

hello_world() -> erlang:display("hello, world\n").
lawik@MacBook-Pro lumen-testing % lumen compile hello.erl
   Compiling hello.erl
Assertion failed: (impl && "isa<> used on a null type."), function isa, file /Users/paulschoenfelder/src/github.com/bitwalker/llvm-project/mlir/include/mlir/IR/Types.h, line 292.
zsh: abort      lumen compile hello.erl

@lawik the fact you hit the isa error isn’t good, but in general, you need to export init:start/0 and have it be your entry point currently, so rename the module to init and hello_world/0 to start/0.

lawik commented

Hehe, I know so little about what I'm doing with Erlang right now. Really need to read up. From your description I thought this would work:

-module(init).
-export([start/0]).

start() -> erlang:display("hello, world\n").

No such luck, same error. Even renamed to init.erl if that helps. I'll take a look at the test code that Paul mentioned in the Slack to try some of the samples from the actual test suite. But I'm currently being a fairly effective "normal non-compiler developer from Elixir-land" so I think this is useful idiot-proofing ;)

lawik commented

Same thing for: ./native_implemented/otp/tests/lib/erlang/get_1/with_key_returns_value/init.erl

I have the same problem using the realse version.
I tried to compile:
.../that_is_positive_with_positive_big_integer_addend_returns_greater_big_integer/init.erl

-module(init).
-export([start/0]).
-import(erlang, [display/1]).
-import(lumen, [is_big_integer/1]).

start() ->
  Augend = augend(),
  Sum = Augend + addend(),
  display(Sum > Augend),
  display(is_big_integer(Sum)).

augend() ->
  BigInteger = (1 bsl 46),
  display(is_big_integer(BigInteger)),
  display(BigInteger > 0),
  BigInteger.

addend() ->
  BigInteger = (1 bsl 46),
  display(is_big_integer(BigInteger)),
  display(BigInteger > 0),
  BigInteger.

Looks like there is an issue with the release binary versus compiling from source, I'll take a look and get that addressed for the next release (sometime in the next week).