[erlang-questions] What erlc flags are needed to compile native (HiPE) to run on smp-disabled runtime?
Mikael Pettersson
mikpe@REDACTED
Sun Oct 12 20:44:29 CEST 2008
Edwin Fine writes:
> To generate native code for smp-enabled runtime using erlc is easy. I can't
> seem to make it happen for smp disabled runtime.
>
> If I start up Erlang with -smp disable and compile from within Erlang, then
> it does what I want (creates a natively-compiled beam for non-smp use).
>
> $ erl -smp disable
> 1> c(mymodule, [native, {hipe, o3}])
> {ok,mymodule}
> 8>
>
> But this is very inconvenient if a build system is created that relies on
> erlc. Is there a better way?
For various reasons the HiPE compiler can only generate code
for the runtime system it's running on, so to generate non-SMP
code you must run the compiler from within a non-SMP system.
Unfortunately there doesn't seem to be any flag to erlc to make
it choose a non-default runtime system, or a way to pass on raw
options to erl instead of the compiler. erl (erlexec.c), however,
can take command-line options from the environment, and the
following seems to work:
ERL_AFLAGS='-smp disable' erlc +native Module.erl
But extending erts/etc/common/erlc.c to accept
erlc -smp disable MoreOptions
with the same meaning as for erl, or to accept
erlc -erl ErlOption ...
and pass ErlOption verbatim to erl would be a nicer solution.
/Mikael
More information about the erlang-questions
mailing list