How portable are Erlang beam files?
Asked Answered
O

2

15

I have a temporary situation where beam files compiled on one node are executed on another node. Are the beam files portable?

How close do the versions of the Erlang distributions need to be?

Outline answered 12/2, 2010 at 22:53 Comment(0)
O
11

Beam files are portable across nodes, as they are bytecode that is interpreted by the Erlang VM, in the same way that Java works. The exception is if they're compiled for native optimization (+native), in which case they're obviously not very portable, other than possibly between windows machines. (edit two years later: also machines that have identical hardware and software setups, as you would possibly find in telecom uses of erlang)

Version wise, it's obvious that you shouldn't use features that the oldest version doesn't support. As long as the features are supported, it should work even if the version gap is big.

Note also that some modules may have been experimental in earlier versions, and so their functions may have had slightly different results.

Oversold answered 13/2, 2010 at 0:42 Comment(2)
Thanks for your answer and your time. Are any path names "hardcoded" into the beam file?Outline
only if you specify path names in it.Oversold
A
7

Beam files should be fairly portable across nodes. If nodes are running different versions of the Erlang VM, then you might have troubles. Features to be especially wary of include the use of parameterized modules and the -extends() module attribute. If one of the machines is running a VM that was installed via a package manager (i.e. apt), it's probably old. One module that I've had difficulty with in the past is the regular expression module re.

Ankeny answered 13/2, 2010 at 3:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.