[erlang-questions] Compiling erlang core modules with +native and -smp

Mikael Pettersson mikpe@REDACTED
Tue May 27 17:24:43 CEST 2008


Colm Dougan writes:
 > Hi list,
 > 
 > I had to compile the Debian version of erlang from source (to apply
 > the zlib patch) and I noticed that there was an optional native.diff
 > patch which builds the core erlang modules (stdlib, io_lib etc) using
 > the +native option.  I decided to try this patch as I need all the
 > performance I can get :)
 > 
 > Anyway, later when I ran some code with this erlang using the -smp
 > option to 'erl' I got lots of warnings like this :
 > 
 > =INFO REPORT==== 27-May-2008::15:31:24 ===
 > <HiPE (v 3.6.3)> Warning: not loading native code for module io_lib:
 > it was compiled for an incompatible runtime system; please regenerate
 > native code for this runtime system
 > 
 > I guess this is because the +native code is not compatible with -smp
 > and modules need to be compiled with both +native *and* -smp in order
 > for the native code to be used.

No, native and SMP are fully compatible. However, native code compiled
for an SMP runtime is incompatible with a non-SMP runtime, and native
code compiled for a non-SMP runtime is incompatible with an SMP runtime.
(And there is little we can do about that incompatibility without
sacrificing runtime performance on non-SMP, alas.)

You need to take care to use the same SMP-or-not runtime system at
compile-time as you intend to use at runtime.

/Mikael



More information about the erlang-questions mailing list