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

Anders Nygren <>
Fri Aug 15 22:45:35 CEST 2008


On Fri, Aug 15, 2008 at 2:16 PM, Mikael Pettersson <> wrote:
> 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?

The problem that I remember was that hipe itself does not work on a 32 bit
system when it has been compiled on a 64 bit system.
I.e. I once got from Erlware a hipe that was compiled for 64 bits and I have 32
bit machine. When I tried to compile another module with +native the
compilation failed.

As far as I understand the hipe application is pure erlang, but there
is a .hrl file
in hipe that defines the sizes of various object, and these sizes depends on the
word size of the machine. I think it was lib/hipe/rtl/hipe_literals.hrl.

/Anders

>
>  > 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
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list