LinuxCommandLibrary

erlc

TLDR

Compile Erlang module

$ erlc [module.erl]
copy
Compile to specific directory
$ erlc -o [ebin] [module.erl]
copy
Compile with debug info
$ erlc +debug_info [module.erl]
copy
Include header directory
$ erlc -I [include] [module.erl]
copy
Compile multiple files
$ erlc [*.erl]
copy
Show warnings as errors
$ erlc -Werror [module.erl]
copy

SYNOPSIS

erlc [options] files...

DESCRIPTION

erlc is the Erlang compiler, converting Erlang source files (.erl) to BEAM bytecode (.beam). It's the standard way to compile Erlang modules.
The compiler supports various options for optimization, debugging, and include paths. It's typically invoked through build tools like rebar3 but can be used directly.

PARAMETERS

-o directory

Output directory for compiled files.
-I directory
Add include directory.
-D name[=value]
Define macro.
-W level
Warning level.
-Werror
Treat warnings as errors.
+debug_info
Include debug information.
+native
Native code compilation (HiPE).
-b type
Output type (beam, asm, etc.).
-v
Verbose output.
-pa path
Add code path.

CAVEATS

Requires Erlang/OTP installed. Native compilation deprecated in OTP 24+. Include paths must be specified explicitly. Module name must match filename.

HISTORY

erlc has been part of Erlang/OTP since its early releases. Erlang was developed at Ericsson by Joe Armstrong and others starting in 1986, released as open source in 1998. The compiler generates BEAM bytecode for the Erlang virtual machine.

SEE ALSO

erl(1), rebar3(1), dialyzer(1), escript(1)

Copied to clipboard