[erlang-questions] 64bit compiled beams not running on 32 bit machines

Mikael Pettersson <>
Fri Aug 15 21:16:57 CEST 2008


Logan, Martin writes:
 > In working on Erlware we have run into cases where apps containing only
 > beam object code get published from 64 bit machines and are subsequently
 > installed and run on 32 bit machines (the code is "generic" after all)
 > and so the installer makes no distinction in cases of pure beam code.
 > Well, as it turns out we have seen problems. 

What problems?

 > Does any one know if this 
 > is a general problem, is it always unsafe to run 64bit compiled beams on
 > 32bit machines or is it only in special cases, as in code compiled as
 > "native"?

Plain native-free beam code should be machine-independent.
It is not independent of the BEAM virtual machine version,
so unless you take special precautions (BEAM compiler options)
you cannot generate the .beam code using BEAM version N and
then deploy it with BEAM versions M < N.

(Building an Erlang/OTP system relies on being able to use a
set of pre-generated .beam files from bootstrap/ with the
newly-built virtual machine; this combination is then used
to re-generate .beam files for everything under lib/.)

Code generated with +native depends on the machine type
(x86 vs powerpc vs ...), its word-size (32 or 64-bit),
whether it's using the SMP or non-SMP virtual machine,
and the version of the BEAM virtual machine.
You can only use native code on another machine than the
build machine if the other machine is identical to the
build machine in all above-mentioned aspects.

/Mikael



More information about the erlang-questions mailing list