If you're using the Ubuntu packages, install erlang-base-hipe
instead of erlang-base
(one replaces the other). HIPE stands for "High-Performance Erlang".
Native compilation is not the only kind of compilation. If you use -mode(compile)
instead, the script will be compiled to BEAM byte code before being run. This works regardless of whether your Erlang installation supports HIPE, and will be fast enough in most cases.
You also get a second error message:
escript: exception error: no function clause matching test__escript__1383__893414__479613:main([]) (./test, line 5)
This is not related to native compilation. It just means that you called the escript with zero arguments, but it only accepts exactly one argument. You could make it somewhat user-friendlier by adding a second clause to the main
function:
main(Args) ->
io:format("expected one argument, but got ~b~n", [length(Args)]),
halt(1).