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¶
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 |
| - | --dump-symtab |
Dump serialized symbol tables |
| - | --dump-types |
Dump all used types |
| - | --dump-cache-stats |
Dump stats for compiler-internal lookup caches |
-ir |
--dump-ir |
Dump LLVM-IR |
-s, -asm |
--dump-assembly |
Dump Assembly code |
| - | --dump-object-file |
Dump object files |
| - | --dump-dependency-graph |
Dump compile unit dependency graph |
| - | --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 (default), -O3, -Os, -Oz |
-m |
--build-mode |
Controls the build mode. Valid values: debug (default), release and test. |
-lto |
- | Enable link-time-optimization |
-g |
--debug-info |
Generate debug info to debug the executable in GDB, etc. Valid values: full (default when the flag is given without a value), line-only (DWARF line tables only) and none. A level can only be attached to the long form (e.g. --debug-info=line-only); -g is an alias for --debug-info=full. |
-b |
--build-var |
Add build variable to parametrize the compiled program (e.g. -v key=value) |
| - | --sanitize |
Enable instrumentation for sanitizer. Valid values: none (default), address, thread, memory and type. |
| - | --coverage |
Instrument code for coverage analysis (gcov-compatible .gcno/.gcda output). Implies --debug-info=line-only if no debug info level was requested explicitly, rejects an explicit --debug-info=none, and is incompatible with -lto. |
| - | --static |
Produce stand-alone executable by linking statically |
| - | --strip-symbols |
Strip the symbol table from the executable. Makes it smaller, at the price of stack traces whose frames all print as <unknown>. Combined with --debug-info it removes the debug info too, same as gcc -g -s |
| - | --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 |
| - | --use-lifetime-markers |
Generate lifetime markers to enhance optimizations |
| - | --use-tbaa-metadata |
Generate metadata for type-based alias analysis to enhance optimizations |
| - | --keep-frame-pointers |
Set up a frame pointer in every function, so profilers can walk the stack |
| - | --output-container |
Format of the compilation output container. Valid values: exec (default), obj, lib, dylib) |
| - | --backend |
Codegen backend. Valid values: llvm (default), tpde (experimental — see how-to; requires opt-in build with -DSPICE_ENABLE_TPDE=ON). |