<div dir="ltr">Thanks, Mikael.<br><br><div class="gmail_quote">On Sun, Oct 12, 2008 at 2:44 PM, Mikael Pettersson <span dir="ltr"><<a href="mailto:mikpe@it.uu.se">mikpe@it.uu.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">Edwin Fine writes:<br>
> To generate native code for smp-enabled runtime using erlc is easy. I can't<br>
> seem to make it happen for smp disabled runtime.<br>
><br>
> If I start up Erlang with -smp disable and compile from within Erlang, then<br>
> it does what I want (creates a natively-compiled beam for non-smp use).<br>
><br>
> $ erl -smp disable<br>
> 1> c(mymodule, [native, {hipe, o3}])<br>
> {ok,mymodule}<br>
> 8><br>
><br>
> But this is very inconvenient if a build system is created that relies on<br>
> erlc. Is there a better way?<br>
<br>
</div></div>For various reasons the HiPE compiler can only generate code<br>
for the runtime system it's running on, so to generate non-SMP<br>
code you must run the compiler from within a non-SMP system.<br>
<br>
Unfortunately there doesn't seem to be any flag to erlc to make<br>
it choose a non-default runtime system, or a way to pass on raw<br>
options to erl instead of the compiler. erl (erlexec.c), however,<br>
can take command-line options from the environment, and the<br>
following seems to work:<br>
<br>
ERL_AFLAGS='-smp disable' erlc +native Module.erl<br>
<br>
But extending erts/etc/common/erlc.c to accept<br>
<br>
erlc -smp disable MoreOptions<br>
<br>
with the same meaning as for erl, or to accept<br>
<br>
erlc -erl ErlOption ...<br>
<br>
and pass ErlOption verbatim to erl would be a nicer solution.<br>
<font color="#888888"><br>
/Mikael<br>
<br>
</font></blockquote></div><br></div>