[erlang-questions] can i tell what version or erlang a .beam was compiled with?
Roger Lipscombe
roger@REDACTED
Fri May 8 20:28:46 CEST 2015
On 8 May 2015 at 18:41, Garry Hodgson <garry@REDACTED> wrote:
> is there any way i can determine from a .beam file
> what version of erlang was used to compile it? or, for that
> matter, any other way to rule out or confirm this possibility?
beam_lib has what you need:
<0.39.0> (myapp@REDACTED) 4> {_, Beam, _} = code:get_object_code(foo).
{foo,<<70,79,82,49,0,1,102,184,66,69,65,77,65,116,
111,109,0,0,17,242,0,0,1,51,11,105,109,...>>,
"/home/roger/Private/Source/myapp/apps/myapp/ebin/foo.beam"}
<0.39.0> (myapp@REDACTED) 5> beam_lib:chunks(Beam, [compile_info]).
{ok,{foo,[{compile_info,[{options,[{outdir,"ebin"},
debug_info,
{parse_transform,lager_transform},
warnings_as_errors,warn_unused_vars,warn_shadow_vars,
warn_unused_import,warn_unused_function,warn_bif_clash,
warn_unused_record,warn_deprecated_function,
warn_obsolete_guard,warn_export_vars,warn_exported_vars,
debug_info,
{i,"include"}]},
{version,"4.9.4"},
{time,{2015,5,5,14,3,14}},
{source,"/home/roger/Private/Source/myapp/apps/myapp/src/foo.erl"}]}]}}
What's that "4.9.4"? It's the compiler version...
<0.39.0> (myapp@REDACTED) 6> code:which(compile).
"/usr/local/erlang-R16B03-1/lib/compiler-4.9.4/ebin/compile.beam"
More information about the erlang-questions
mailing list