firefly icon indicating copy to clipboard operation
firefly copied to clipboard

Not compiling the erlang.org hello world

Open lawik opened this issue 4 years ago • 5 comments

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 avatar Sep 03 '20 06:09 lawik

@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.

KronicDeth avatar Sep 03 '20 06:09 KronicDeth

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 avatar Sep 03 '20 10:09 lawik

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

lawik avatar Sep 04 '20 05:09 lawik

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.

mazz-seven avatar Sep 14 '20 12:09 mazz-seven

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).

bitwalker avatar Sep 23 '20 15:09 bitwalker