Skip to content

Build subcommand

The build subcommand can be used to compile your Spice project to an executable file and save it to the current directory.

Usage

Use the build subcommand by executing:

Bash
$ spice build [options] <main-source-file>

Use the build command by executing:

Bash
$ spice b [options] <mail-source-file>

Options

You can apply following options to the build subcommand:

Option Long Description
-d --debug-output Print compiler output for debugging.
-cst --dump-cst Dump CST as serialized string and SVG image
-ast --dump-ast Dump AST as serialized string and SVG image
-symtab --dump-symtab Dump serialized symbol tables
-ir --dump-ir Dump LLVM-IR
-s, -asm --dump-assembly Dump Assembly code
-b, -obj --dump-object-file Dump object files
- --dump-to-files Redirect all dumps to files instead of printing them to the screen
- --abort-after-dump Abort the compilation process after dumping the first requested resource
-j <n> --jobs <n> Set number of jobs to parallelize compilation (default is auto)
-t --target Target triple for the emitted executable (for cross-compiling).
Format: <arch><sub>-<vendor>-<sys>-<abi>
-o --output Set path for executable output.
-O<n> - Set optimization level.
Valid options: -O0, -O1, -O2, -O3, -Os, -Oz
-m --build-mode Controls the build mode. Valid values are debug, release and test.
-lto - Enable link-time-optimization
-g --debug-info Generate debug info to debug the executable in GDB, etc.
- --static Produce stand-alone executable by linking statically
- --no-entry Do not require or generate main function (useful for web assembly target)
- --disable-verifier Disable LLVM module and function verification (only recommended for debugging the compiler)
- --ignore-cache Compile always and ignore the compile cache