Fields

step: Step,
name: []const u8,
target: CrossTarget,
target_info: NativeTargetInfo,
optimize: std.builtin.Mode,
linker_script: ?LazyPath = null,
version_script: ?[]const u8 = null,
out_filename: []const u8,
linkage: ?Linkage = null,
version: ?std.SemanticVersion,
kind: Kind,
major_only_filename: ?[]const u8,
name_only_filename: ?[]const u8,
strip: ?bool,
unwind_tables: ?bool,
compress_debug_sections: enum {
    none,
    zlib,
    _,
} = .none,
lib_paths: ArrayList(LazyPath),
framework_dirs: ArrayList(LazyPath),
verbose_link: bool,
verbose_cc: bool,
bundle_compiler_rt: ?bool = null,
single_threaded: ?bool,
stack_protector: ?bool = null,
disable_stack_probing: bool,
disable_sanitize_c: bool,
sanitize_thread: bool,
rdynamic: bool,
dwarf_format: ?std.dwarf.Format = null,
import_memory: bool = false,
export_memory: bool = false,
import_symbols: bool = false,

For WebAssembly targets, this will allow for undefined symbols to be imported from the host environment.

import_table: bool = false,
export_table: bool = false,
initial_memory: ?u64 = null,
max_memory: ?u64 = null,
shared_memory: bool = false,
global_base: ?u64 = null,
c_std: std.Build.CStd,
zig_lib_dir: ?LazyPath,

Set via options; intended to be read-only after that.

main_pkg_path: ?LazyPath,

Set via options; intended to be read-only after that.

exec_cmd_args: ?[]const ?[]const u8,
filter: ?[]const u8,
test_evented_io: bool = false,
test_runner: ?[]const u8,
code_model: std.builtin.CodeModel = .default,
wasi_exec_model: ?std.builtin.WasiExecModel = null,
export_symbol_names: []const []const u8 = ref,

Symbols to be exported when compiling to wasm

root_src: ?LazyPath,
out_lib_filename: []const u8,
modules: field_call,
link_objects: ArrayList(LinkObject),
include_dirs: ArrayList(IncludeDir),
c_macros: ArrayList([]const u8),
installed_headers: ArrayList(*Step),
is_linking_libc: bool,
is_linking_libcpp: bool,
vcpkg_bin_path: ?[]const u8 = null,
installed_path: ?[]const u8,
image_base: ?u64 = null,

Base address for an executable image.

libc_file: ?LazyPath = null,
valgrind_support: ?bool = null,
each_lib_rpath: ?bool = null,
build_id: ?BuildId = null,

On ELF targets, this will emit a link section called “.note.gnu.build-id” which can be used to coordinate a stripped binary with its debug symbols. As an example, the bloaty project refuses to work unless its inputs have build ids, in order to prevent accidental mismatches. The default is to not include this section because it slows down linking.

link_eh_frame_hdr: bool = false,

Create a .eh_frame_hdr section and a PT_GNU_EH_FRAME segment in the ELF file.

link_emit_relocs: bool = false,
link_function_sections: bool = false,

Place every function in its own section so that unused ones may be safely garbage-collected during the linking phase.

link_gc_sections: ?bool = null,

Remove functions and data that are unreachable by the entry point or exported symbols.

linker_dynamicbase: bool = true,

(Windows) Whether or not to enable ASLR. Maps to the /DYNAMICBASE[:NO] linker argument.

linker_allow_shlib_undefined: ?bool = null,
link_z_notext: bool = false,

Permit read-only relocations in read-only segments. Disallowed by default.

link_z_relro: bool = true,

Force all relocations to be read-only after processing.

link_z_lazy: bool = false,

Allow relocations to be lazily processed after load.

link_z_common_page_size: ?u64 = null,

Common page size

link_z_max_page_size: ?u64 = null,

Maximum page size

install_name: ?[]const u8 = null,

(Darwin) Install name for the dylib

entitlements: ?[]const u8 = null,

(Darwin) Path to entitlements file

pagezero_size: ?u64 = null,

(Darwin) Size of the pagezero segment.

headerpad_size: ?u32 = null,

(Darwin) Set size of the padding between the end of load commands and start of __TEXT,__text section.

headerpad_max_install_names: bool = false,

(Darwin) Automatically Set size of the padding between the end of load commands and start of __TEXT,__text section to a value fitting all paths expanded to MAXPATHLEN.

dead_strip_dylibs: bool = false,

(Darwin) Remove dylibs that are unreachable by the entry point or exported symbols.

force_pic: ?bool = null,

Position Independent Code

pie: ?bool = null,

Position Independent Executable

red_zone: ?bool = null,
omit_frame_pointer: ?bool = null,
dll_export_fns: ?bool = null,
subsystem: ?std.Target.SubSystem = null,
entry_symbol_name: ?[]const u8 = null,
force_undefined_symbols: field_call,

List of symbols forced as undefined in the symbol table thus forcing their resolution by the linker. Corresponds to -u <symbol> for ELF/MachO and /include:<symbol> for COFF/PE.

stack_size: ?u64 = null,

Overrides the default stack size

want_lto: ?bool = null,
use_llvm: ?bool,
use_lld: ?bool,
expect_errors: []const []const u8 = ref,

This is an advanced setting that can change the intent of this Compile step. If this slice has nonzero length, it means that this Compile step exists to check for compile errors and return success if they match, and failure otherwise.

emit_directory: ?*GeneratedFile,
generated_docs: ?*GeneratedFile,
generated_asm: ?*GeneratedFile,
generated_bin: ?*GeneratedFile,
generated_pdb: ?*GeneratedFile,
generated_implib: ?*GeneratedFile,
generated_llvm_bc: ?*GeneratedFile,
generated_llvm_ir: ?*GeneratedFile,
generated_h: ?*GeneratedFile,

Functions

fn addAnonymousModule(cs: *Compile, name: []const u8, options: std.Build.CreateModuleOptions) void

Adds a module to be used with @import without exposing it in the current pack…

Adds a module to be used with @import without exposing it in the current package’s module table.

fn addAssemblyFile(self: *Compile, source: LazyPath) void

No documentation provided.

fn addCSourceFile(self: *Compile, source: CSourceFile) void

No documentation provided.

fn addCSourceFiles(self: *Compile, files: []const []const u8, flags: []const []const u8) void

Handy when you have many C/C++ source files and want them all to have the same f…

Handy when you have many C/C++ source files and want them all to have the same flags.

fn addConfigHeader(self: *Compile, config_header: *Step.ConfigHeader) void

No documentation provided.

fn addFrameworkPath(self: *Compile, directory_source: LazyPath) void

No documentation provided.

fn addIncludePath(self: *Compile, path: LazyPath) void

No documentation provided.

fn addLibraryPath(self: *Compile, directory_source: LazyPath) void

No documentation provided.

fn addModule(cs: *Compile, name: []const u8, module: *Module) void

Adds a module to be used with @import and exposing it in the current package’…

Adds a module to be used with @import and exposing it in the current package’s module table using name.

fn addObjCopy(cs: *Compile, options: Step.ObjCopy.Options) *Step.ObjCopy

No documentation provided.

fn addObject(self: *Compile, obj: *Compile) void

No documentation provided.

fn addObjectFile(self: *Compile, source: LazyPath) void

No documentation provided.

fn addOptions(cs: *Compile, module_name: []const u8, options: *Step.Options) void

No documentation provided.

fn addRPath(self: *Compile, directory_source: LazyPath) void

No documentation provided.

fn addSystemIncludePath(self: *Compile, path: LazyPath) void

No documentation provided.

fn addVcpkgPaths(self: *Compile, linkage: Compile.Linkage) !void

If Vcpkg was found on the system, it will be added to include and lib paths for…

If Vcpkg was found on the system, it will be added to include and lib paths for the specified target.

fn checkObject(self: *Compile) *Step.CheckObject

No documentation provided.

fn create(owner: *std.Build, options: Options) *Compile

No documentation provided.

fn defineCMacro(self: *Compile, name: []const u8, value: ?[]const u8) void

If the value is omitted, it is set to 1. name and value need not live longe…

If the value is omitted, it is set to 1. name and value need not live longer than the function call.

fn defineCMacroRaw(self: *Compile, name_and_value: []const u8) void

name_and_value looks like [name]=[value]. If the value is omitted, it is set to …

name_and_value looks like [name]=[value]. If the value is omitted, it is set to 1.

fn dependsOnSystemLibrary(self: Compile, name: []const u8) bool

Returns whether the library, executable, or object depends on a particular syste…

Returns whether the library, executable, or object depends on a particular system library.

fn doAtomicSymLinks(step: *Step, output_path: []const u8, filename_major_only: []const u8, filename_name_only: []const u8) !void

No documentation provided.

fn forceUndefinedSymbol(self: *Compile, symbol_name: []const u8) void

No documentation provided.

fn getEmittedAsm(self: *Compile) LazyPath

Returns the path to the generated assembly code.

fn getEmittedBin(self: *Compile) LazyPath

Returns the path to the generated executable, library or object file. To run an…

Returns the path to the generated executable, library or object file. To run an executable built with zig build, use run, or create an install step and invoke it.

fn getEmittedBinDirectory(self: *Compile) LazyPath

Returns the path to the directory that contains the emitted binary file.

fn getEmittedDocs(self: *Compile) LazyPath

Returns the path to the generated documentation directory.

fn getEmittedH(self: *Compile) LazyPath

Returns the path to the generated header file. This function can only be called…

Returns the path to the generated header file. This function can only be called for libraries or objects.

fn getEmittedImplib(self: *Compile) LazyPath

Returns the path to the generated import library. This function can only be cal…

Returns the path to the generated import library. This function can only be called for libraries.

fn getEmittedLlvmBc(self: *Compile) LazyPath

Returns the path to the generated LLVM BC.

fn getEmittedLlvmIr(self: *Compile) LazyPath

Returns the path to the generated LLVM IR.

fn getEmittedPdb(self: *Compile) LazyPath

Returns the generated PDB file. If the compilation does not produce a PDB file,…

Returns the generated PDB file. If the compilation does not produce a PDB file, this causes a FileNotFound error at build time.

fn installConfigHeader(cs: *Compile, config_header: *Step.ConfigHeader, options: InstallConfigHeaderOptions) void

No documentation provided.

fn installHeader(cs: *Compile, src_path: []const u8, dest_rel_path: []const u8) void

No documentation provided.

fn installHeadersDirectory(a: *Compile, src_dir_path: []const u8, dest_rel_path: []const u8) void

No documentation provided.

fn installHeadersDirectoryOptions(cs: *Compile, options: std.Build.Step.InstallDir.Options) void

No documentation provided.

fn installLibraryHeaders(cs: *Compile, l: *Compile) void

No documentation provided.

fn isDynamicLibrary(self: *Compile) bool

No documentation provided.

fn isStaticLibrary(self: *Compile) bool

No documentation provided.

fn linkFramework(self: *Compile, framework_name: []const u8) void

No documentation provided.

fn linkFrameworkNeeded(self: *Compile, framework_name: []const u8) void

No documentation provided.

fn linkFrameworkWeak(self: *Compile, framework_name: []const u8) void

No documentation provided.

fn linkLibC(self: *Compile) void

No documentation provided.

fn linkLibCpp(self: *Compile) void

No documentation provided.

fn linkLibrary(self: *Compile, lib: *Compile) void

No documentation provided.

fn linkSystemLibrary(self: *Compile, name: []const u8) void

No documentation provided.

fn linkSystemLibrary2(self: *Compile, name: []const u8, options: LinkSystemLibraryOptions) void

No documentation provided.

fn linkSystemLibraryName(self: *Compile, name: []const u8) void

deprecated: use linkSystemLibrary2

fn linkSystemLibraryNeeded(self: *Compile, name: []const u8) void

deprecated: use linkSystemLibrary2

fn linkSystemLibraryNeededName(self: *Compile, name: []const u8) void

deprecated: use linkSystemLibrary2

fn linkSystemLibraryNeededPkgConfigOnly(self: *Compile, lib_name: []const u8) void

deprecated: use linkSystemLibrary2

fn linkSystemLibraryPkgConfigOnly(self: *Compile, lib_name: []const u8) void

deprecated: use linkSystemLibrary2

fn linkSystemLibraryWeak(self: *Compile, name: []const u8) void

deprecated: use linkSystemLibrary2

fn linkSystemLibraryWeakName(self: *Compile, name: []const u8) void

deprecated: use linkSystemLibrary2

fn producesImplib(self: *Compile) bool

No documentation provided.

fn producesPdbFile(self: *Compile) bool

No documentation provided.

fn setExecCmd(self: *Compile, args: []const ?[]const u8) void

No documentation provided.

fn setLibCFile(self: *Compile, libc_file: ?LazyPath) void

No documentation provided.

fn setLinkerScript(self: *Compile, source: LazyPath) void

No documentation provided.

fn setLinkerScriptPath(self: *Compile, source: LazyPath) void

deprecated: use setLinkerScript

fn setVerboseCC(self: *Compile, value: bool) void

No documentation provided.

fn setVerboseLink(self: *Compile, value: bool) void

No documentation provided.

Values

base_id
Step.Id
install
undefined

This function would install in the context of the package that created the artif…

run
undefined

This function would run in the context of the package that created the executabl…