CRYSTAL-BUILD(1)
π NAME π
okay bestie, welcome to crystal-build(1) β straight out of the Crystal Compiler Command Line Reference Guide β and it's literally all about how to compile a Crystal program. π¦β¨
β¨ SYNOPSIS β¨
run it like this, no cap:
crystal build [options] [programfile] [--] [arguments]
π OPTIONS π
here's the full menu, every single flag, zero skips π
--cross-compileβ generate an object file for cross compilation and print the command to build the executable. The object file should be copied to the target system and the printed command should be executed there. This flag mainly exists for porting the compiler to new platforms; where possible, run the compiler on the target platform directly. π«Ά-d,--debugβ generate the output with symbolic debug symbols. These are read when debugging the built program with tools likelldb,gdb,valgrindetc. and provide mappings to the original source code for those tools. π--no-debugβ generate the output without any symbolic debug symbols. simple as that β¨-D FLAG,--define FLAGβ define a compile-time flag. This is useful to conditionally define types, methods, or commands based on flags available at compile time. The default flags are from the target triple given with--target-tripleor the hosts default, if none is given. π--emit [asm|llvm-bc|llvm-ir|obj]β comma separated list of types of output for the compiler to emit. You can use this to see the generated LLVM IR, LLVM bitcode, assembly, and object files. π--x86-asm-syntax [att|intel]β select the assembly dialect for--emit=asm. The default isatt, which stands for the AT&T syntax supported by tools like the GNU Assembler.intelselects the Intel syntax which is preferred for Windows tools. π»--frame-pointers [auto|always|non-leaf]β control the preservation of frame pointers. The default value,--frame-pointers=auto, will preserve frame pointers on debug builds and try to omit them on release builds (certain platforms require them to stay enabled).--frame-pointers=alwayswill always preserve them, andnon-leafwill only force their preservation on non-leaf functions. π§-f text|json,--format text|jsonβ format of output. Defaults totext. Thejsonformat can be used to get a more parser-friendly output. π--error-traceβ show full error trace. Disabled by default, as the full trace usually makes error messages less readable and may not always deliver relevant information. π--llβ dump LLVM assembly file to output directory. π₯--link-flags FLAGSβ pass additional flags to the linker. Though you can specify those flags on the source code, this is useful for passing environment specific information directly to the linker, like non-standard library paths or names. For more information on specifying linker flags on source, you can read the "C bindings" section of the documentation available on the official web site. π--mcpu CPUβ specify a specific CPU to generate code for. This will pass a-mcpuflag to LLVM, and is only intended to be used for cross-compilation. For a list of available CPUs, pass--mcpu helpwhen building any Crystal source code. Passing--mcpu nativewill pass the host CPU name to tune performance for the host. π--mattr CPUβ override or control specific attributes of the target, such as whether SIMD operations are enabled or not. The default set of attributes is set by the current CPU. This will pass a-mattrflag to LLVM, and is only intended to be used for cross-compilation. For a list of available attributes, invoke this exact thing:
llvm-as < /dev/null | llc -march=xyz -mattr=help.`
--mcmodel default|kernel|tiny|small|medium|largeβ specifies a specific code model to generate code for. This will pass a--code-modelflag to LLVM. π--no-colorβ disable colored output. (sad but sometimes necessary π)--no-codegenβ donβt do code generation, just parse the file. π-o FILE,--output FILEβ specify output path. If a directory, the filename is derived from the first source file (default: current directory). π--preludeβ specify prelude to use. The default one initializes the garbage collector. You can also use--prelude=emptyto use no preludes. This can be useful for checking code generation for a specific source code file. π§Ή-O LEVELβ optimization mode:0(default),1,2,3. See OPTIMIZATIONS for details. β‘--releaseβ compile in release mode. Equivalent to-O3 --single-module. π-s,--statsβ print statistics about the different compiler stages for the current build. Output time and used memory for each compiler process. π-p,--progressβ print statistics about the progress for the current build. π-t,--timeβ print statistics about the execution time. β±οΈ--single-moduleβ generate a single LLVM module. By default, one LLVM module is created for each type in a program.--releaseimplies this option. π§©--threads NUMβ maximum number of threads to use for code generation. The default is8threads. π§΅--target TRIPLEβ enable target triple; intended to use for cross-compilation. See llvm documentation for more information about target triple. π―--verboseβ display the commands executed by the system. π--staticβ create a statically linked executable. π§±--stdin-filename FILENAMEβ source file name to be read from STDIN. β¨οΈ
that's the whole page, bestie β sourced from crystal 1.22.2, dated 2026-10-30. mwah ππ«Άβ¨
π¦ where this page comes from
- arch rolling: crystal 1.22.2-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms