1# Sample TOML configuration file for building Rust.
2#
3# To configure bootstrap, run `./configure` or `./x.py setup`.
4# See https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#create-a-bootstraptoml for more information.
5#
6# All options are commented out by default in this file, and they're commented
7# out with their default values. The build system by default looks for
8# `bootstrap.toml` in the current directory of a build for build configuration, but
9# a custom configuration file can also be specified with `--config` to the build
10# system.
11#
12# Note that the following are equivalent, for more details see <https://toml.io/en/v1.0.0>.
13#
14# build.verbose = 1
15#
16# [build]
17# verbose = 1
18
19
20# =============================================================================
21# Global Settings
22# =============================================================================
23
24# Use different pre-set defaults than the global defaults.
25#
26# See `src/bootstrap/defaults` for more information.
27# Note that this has no default value (x.py uses the defaults in `bootstrap.example.toml`).
28#profile = <none>
29
30# Inherits configuration values from different configuration files (a.k.a. config extensions).
31# Supports absolute paths, and uses the current directory (where the bootstrap was invoked)
32# as the base if the given path is not absolute.
33#
34# The overriding logic follows a right-to-left order. For example, in `include = ["a.toml", "b.toml"]`,
35# extension `b.toml` overrides `a.toml`. Also, parent extensions always overrides the inner ones.
36#include = []
37
38# Keeps track of major changes made to this configuration.
39#
40# This value also represents ID of the PR that caused major changes. Meaning,
41# you can visit github.com/rust-lang/rust/pull/{change-id} to check for more details.
42#
43# A 'major change' includes any of the following
44# - A new option
45# - A change in the default values
46#
47# If the change-id does not match the version currently in use, x.py will
48# display the changes made to the bootstrap.
49# To suppress these warnings, you can set change-id = "ignore".
50#change-id = <latest change id in src/bootstrap/src/utils/change_tracker.rs>
51
52# =============================================================================
53# Tweaking how LLVM is compiled
54# =============================================================================
55
56# Whether to use Rust CI built LLVM instead of locally building it.
57#
58# Unless you're developing for a target where Rust CI doesn't build a compiler
59# toolchain or changing LLVM locally, you probably want to leave this enabled.
60#
61# Set this to `true` to download if CI llvm available otherwise it builds
62# from `src/llvm-project`. If you set it to `true`, it's safe and time-saving to run
63# `git submodule deinit src/llvm-project` to avoid git updating the llvm-project submodule
64# when building compiler locally.
65#
66#
67# Set this to `"if-unchanged"` to download only if the llvm-project has not
68# been modified. You can also use this if you are unsure whether you're on a
69# tier 1 target. All tier 1 targets are currently supported.
70
71# Currently, we only support this when building LLVM for the build triple.
72#
73# Note that many of the LLVM options are not currently supported for
74# downloading. Currently only the "assertions" option can be toggled.
75#llvm.download-ci-llvm = true
76
77# Indicates whether the LLVM build is a Release or Debug build
78#llvm.optimize = true
79
80# Indicates whether LLVM should be built with ThinLTO. Note that this will
81# only succeed if you use clang, lld, llvm-ar, and llvm-ranlib in your C/C++
82# toolchain (see the `cc`, `cxx`, `linker`, `ar`, and `ranlib` options below).
83# More info at: https://clang.llvm.org/docs/ThinLTO.html#clang-bootstrap
84#llvm.thin-lto = false
85
86# Indicates whether an LLVM Release build should include debug info
87#llvm.release-debuginfo = false
88
89# Indicates whether the LLVM assertions are enabled or not
90# NOTE: When assertions are disabled, bugs in the integration between rustc and LLVM can lead to
91# unsoundness (segfaults, etc.) in the rustc process itself, not just in the generated code.
92#llvm.assertions = false
93
94# Indicates whether the LLVM testsuite is enabled in the build or not. Does
95# not execute the tests as part of the build as part of x.py build et al,
96# just makes it possible to do `ninja check-llvm` in the staged LLVM build
97# directory when doing LLVM development as part of Rust development.
98#llvm.tests = false
99
100# Indicates whether the LLVM plugin is enabled or not
101#llvm.plugins = false
102
103# Whether to build Enzyme as AutoDiff backend.
104#llvm.enzyme = false
105
106# Whether to build LLVM with support for it's gpu offload runtime.
107#llvm.offload = false
108
109# Absolute path to the directory containing ClangConfig.cmake
110#llvm.offload-clang-dir = ""
111
112# When true, link libstdc++ statically into the rustc_llvm.
113# This is useful if you don't want to use the dynamic version of that
114# library provided by LLVM.
115#llvm.static-libstdcpp = false
116
117# Enable LLVM to use zstd for compression.
118#llvm.libzstd = false
119
120# Whether to use Ninja to build LLVM. This runs much faster than make.
121#llvm.ninja = true
122
123# LLVM targets to build support for.
124# Note: this is NOT related to Rust compilation targets. However, as Rust is
125# dependent on LLVM for code generation, turning targets off here WILL lead to
126# the resulting rustc being unable to compile for the disabled architectures.
127#
128# To add support for new targets, see https://rustc-dev-guide.rust-lang.org/building/new-target.html.
129#llvm.targets = "AArch64;AMDGPU;ARM;BPF;Hexagon;LoongArch;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86"
130
131# LLVM experimental targets to build support for. These targets are specified in
132# the same format as above, but since these targets are experimental, they are
133# not built by default and the experimental Rust compilation targets that depend
134# on them will not work unless the user opts in to building them.
135#llvm.experimental-targets = "AVR;M68k;CSKY"
136
137# Cap the number of parallel linker invocations when compiling LLVM.
138# This can be useful when building LLVM with debug info, which significantly
139# increases the size of binaries and consequently the memory required by
140# each linker process.
141# If set to 0, linker invocations are treated like any other job and
142# controlled by bootstrap's -j parameter.
143#llvm.link-jobs = 0
144
145# Whether to build LLVM as a dynamically linked library (as opposed to statically linked).
146# Under the hood, this passes `--shared` to llvm-config.
147# NOTE: To avoid performing LTO multiple times, we suggest setting this to `true` when `thin-lto` is enabled.
148#llvm.link-shared = llvm.thin-lto
149
150# When building llvm, this configures what is being appended to the version.
151# To use LLVM version as is, provide an empty string.
152#llvm.version-suffix = if rust.channel == "dev" { "-rust-dev" } else { "-rust-$version-$channel" }
153
154# On MSVC you can compile LLVM with clang-cl, but the test suite doesn't pass
155# with clang-cl, so this is special in that it only compiles LLVM with clang-cl.
156# Note that this takes a /path/to/clang-cl, not a boolean.
157#llvm.clang-cl = cc
158
159# Pass extra compiler and linker flags to the LLVM CMake build.
160#llvm.cflags = ""
161#llvm.cxxflags = ""
162#llvm.ldflags = ""
163
164# Use libc++ when building LLVM instead of libstdc++. This is the default on
165# platforms already use libc++ as the default C++ library, but this option
166# allows you to use libc++ even on platforms when it's not. You need to ensure
167# that your host compiler ships with libc++.
168#llvm.use-libcxx = false
169
170# The value specified here will be passed as `-DLLVM_USE_LINKER` to CMake.
171#llvm.use-linker = <none> (path)
172
173# Whether or not to specify `-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=YES`
174#llvm.allow-old-toolchain = false
175
176# Whether to include the Polly optimizer.
177#llvm.polly = false
178
179# Whether to build the clang compiler.
180#llvm.clang = false
181
182# Whether to enable llvm compilation warnings.
183#llvm.enable-warnings = false
184
185# Custom CMake defines to set when building LLVM.
186#llvm.build-config = {}
187
188# =============================================================================
189# Tweaking how GCC is compiled
190# =============================================================================
191# Download GCC from CI instead of building it locally.
192# Note that this will attempt to download GCC even if there are local
193# modifications to the `src/gcc` submodule.
194# Currently, this is only supported for the `x86_64-unknown-linux-gnu` target.
195#gcc.download-ci-gcc = false
196
197# Provide a directory of prebuilt libgccjit.so dylibs for given (host, target) compilation pairs.
198# This is useful when you want to cross-compile `rustc` to another target since GCC is not a
199# multi-target compiler.
200# You have to use a directory structure that looks like this:
201# `<libgccjit-libs-dir>/<host>/<target>/libgccjit.so`.
202# For example:
203#
204# ```
205# <libgccjit-libs-dir>
206# ├── m68k-unknown-linux-gnu
207# │ └── m68k-unknown-linux-gnu
208# │ └── libgccjit.so
209# └── x86_64-unknown-linux-gnu
210# ├── m68k-unknown-linux-gnu
211# │ └── libgccjit.so
212# └── x86_64-unknown-linux-gnu
213# └── libgccjit.so
214# ```
215# The directory above would allow you to cross-compile rustc from x64 to m68k
216#
217# Note that this option has priority over `gcc.download-ci-gcc`.
218# If you set both, bootstrap will first try to load libgccjit.so from this directory.
219# Only if it isn't found, it will try to download it from CI or build it locally.
220#gcc.libgccjit-libs-dir = "/path/to/libgccjit-libs-dir"
221
222# =============================================================================
223# General build configuration options
224# =============================================================================
225
226# The default stage to use for the `check` subcommand
227#build.check-stage = 0
228
229# The default stage to use for the `doc` subcommand
230#build.doc-stage = 0
231
232# The default stage to use for the `build` subcommand
233#build.build-stage = 1
234
235# The default stage to use for the `test` subcommand
236#build.test-stage = 1
237
238# The default stage to use for the `dist` subcommand
239#build.dist-stage = 2
240
241# The default stage to use for the `install` subcommand
242#build.install-stage = 2
243
244# The default stage to use for the `bench` subcommand
245#build.bench-stage = 2
246
247# A descriptive string to be appended to version output (e.g., `rustc --version`),
248# which is also used in places like debuginfo `DW_AT_producer`. This may be useful for
249# supplementary build information, like distro-specific package versions.
250#
251# IMPORTANT: Changing this value changes crate IDs and symbol name mangling, making
252# compiled artifacts incompatible. PGO profiles cannot be reused across different
253# descriptions, and incremental compilation caches are invalidated. Keep this value
254# consistent when reusing build artifacts.
255#
256# The Rust compiler will differentiate between versions of itself, including
257# based on this string, which means that if you wish to be compatible with
258# upstream Rust you need to set this to "". However, note that if you set this to "" but
259# are not actually compatible -- for example if you've backported patches that change
260# behavior -- this may lead to miscompilations or other bugs.
261#build.description = ""
262
263# Build triple for the pre-compiled snapshot compiler. If `rustc` is set, this must match its host
264# triple (see `rustc --version --verbose`; cross-compiling the rust build system itself is NOT
265# supported). If `rustc` is unset, this must be a platform with pre-compiled host tools
266# (https://doc.rust-lang.org/nightly/rustc/platform-support.html). The current platform must be
267# able to run binaries of this build triple.
268#
269# If `rustc` is present in path, this defaults to the host it was compiled for.
270# Otherwise, `x.py` will try to infer it from the output of `uname`.
271# If `uname` is not found in PATH, we assume this is `x86_64-pc-windows-msvc`.
272# This may be changed in the future.
273#build.build = "x86_64-unknown-linux-gnu" (as an example)
274
275# Which triples to produce a compiler toolchain for. Each of these triples will be bootstrapped from
276# the build triple themselves. In other words, this is the list of triples for which to build a
277# compiler that can RUN on that triple.
278#
279# Defaults to just the `build` triple.
280#build.host = [build.build] (list of triples)
281
282# Which triples to build libraries (core/alloc/std/test/proc_macro) for. Each of these triples will
283# be bootstrapped from the build triple themselves. In other words, this is the list of triples for
284# which to build a library that can CROSS-COMPILE to that triple.
285#
286# Defaults to `host`. If you set this explicitly, you likely want to add all
287# host triples to this list as well in order for those host toolchains to be
288# able to compile programs for their native target.
289#build.target = build.host (list of triples)
290
291# Use this directory to store build artifacts. Paths are relative to the current directory, not to
292# the root of the repository.
293#build.build-dir = "build"
294
295# Instead of downloading the src/stage0 version of Cargo specified, use
296# this Cargo binary instead to build all Rust code
297# If you set this, you likely want to set `rustc` as well.
298#build.cargo = "/path/to/cargo"
299
300# Instead of downloading the src/stage0 version of the compiler
301# specified, use this rustc binary instead as the stage0 snapshot compiler.
302# If you set this, you likely want to set `cargo` as well.
303#build.rustc = "/path/to/rustc"
304
305# Use this rustdoc binary as the stage0 snapshot rustdoc.
306# If unspecified, then the binary "rustdoc" (with platform-specific extension, e.g. ".exe")
307# in the same directory as "rustc" will be used.
308#build.rustdoc = "/path/to/rustdoc"
309
310# Instead of downloading the src/stage0 version of rustfmt specified,
311# use this rustfmt binary instead as the stage0 snapshot rustfmt.
312#build.rustfmt = "/path/to/rustfmt"
313
314# Instead of downloading the src/stage0 version of cargo-clippy specified,
315# use this cargo-clippy binary instead as the stage0 snapshot cargo-clippy.
316#
317# Note that this option should be used with the same toolchain as the `rustc` option above.
318# Otherwise, clippy is likely to fail due to a toolchain conflict.
319#build.cargo-clippy = "/path/to/cargo-clippy"
320
321# Whether to build documentation by default. If false, rustdoc and
322# friends will still be compiled but they will not be used to generate any
323# documentation.
324#
325# You can still build documentation when this is disabled by explicitly passing paths,
326# e.g. `x doc library`.
327#build.docs = true
328
329# Flag to specify whether CSS, JavaScript, and HTML are minified when
330# docs are generated. JSON is always minified, because it's enormous,
331# and generated in already-minified form from the beginning.
332#build.docs-minification = true
333
334# Flag to specify whether private items should be included in the library docs.
335#build.library-docs-private-items = false
336
337# Indicate whether to build compiler documentation by default.
338# You can still build documentation when this is disabled by explicitly passing a path: `x doc compiler`.
339#build.compiler-docs = false
340
341# Indicate whether git submodules are managed and updated automatically.
342#build.submodules = true
343
344# The path to (or name of) the GDB executable to use. This is only used for
345# executing the debuginfo test suite.
346#build.gdb = "gdb"
347
348# The path to (or name of) the LLDB executable to use. This is only used for
349# executing the debuginfo test suite.
350#build.lldb = "lldb"
351
352# The node.js executable to use. Note that this is only used for the emscripten
353# target when running tests, otherwise this can be omitted.
354#build.nodejs = "node"
355
356# The yarn executable to use. Note that this is used for rustdoc-gui tests and
357# tidy js extra-checks, otherwise this can be omitted.
358#
359# Under Windows this should be `yarn.cmd` or path to it (verified on nodejs v18.06), or
360# error will be emitted.
361#build.yarn = "yarn"
362
363# Python interpreter to use for various tasks throughout the build, notably
364# rustdoc tests, and some dist bits and pieces.
365#
366# Defaults to the Python interpreter used to execute x.py.
367#build.python = "python"
368
369# The path to (or name of) the resource compiler executable to use on Windows.
370#build.windows-rc = "rc.exe"
371
372# The path to the REUSE executable to use. Note that REUSE is not required in
373# most cases, as our tooling relies on a cached (and shrunk) copy of the
374# REUSE output present in the git repository and in our source tarballs.
375#
376# REUSE is only needed if your changes caused the overall licensing of the
377# repository to change, and the cached copy has to be regenerated.
378#
379# Defaults to the "reuse" command in the system path.
380#build.reuse = "reuse"
381
382# Force Cargo to check that Cargo.lock describes the precise dependency
383# set that all the Cargo.toml files create, instead of updating it.
384#build.locked-deps = false
385
386# Indicate whether the vendored sources are used for Rust dependencies or not.
387#
388# Vendoring requires additional setup. We recommend using the pre-generated source tarballs if you
389# want to use vendoring. See https://forge.rust-lang.org/infra/other-installation-methods.html#source-code.
390#build.vendor = if "is a tarball source" && "vendor" dir exists && ".cargo/config.toml" file exists { true } else { false }
391
392# If you build the compiler more than twice (stage3+) or the standard library more than once
393# (stage 2+), the third compiler and second library will get uplifted from stage2 and stage1,
394# respectively. If you would like to disable this uplifting, and rather perform a full bootstrap,
395# then you can set this option to true.
396#
397# This is only useful for verifying that rustc generates reproducible builds.
398#build.full-bootstrap = false
399
400# Set the bootstrap/download cache path. It is useful when building rust
401# repeatedly in a CI environment.
402#build.bootstrap-cache-path = /path/to/shared/cache
403
404# Enable a build of the extended Rust tool set which is not only the compiler
405# but also tools such as Cargo. This will also produce "combined installers"
406# which are used to install Rust and Cargo together.
407# The `tools` (check `bootstrap.example.toml` to see its default value) option specifies
408# which tools should be built if `extended = true`.
409#
410# This is disabled by default.
411#build.extended = false
412
413# Set of tools to be included in the installation.
414#
415# If `extended = false`, the only one of these built by default is rustdoc.
416#
417# If `extended = true`, they are all included.
418#
419# If any enabled tool fails to build, the installation fails.
420#build.tools = [
421# "cargo",
422# "clippy",
423# "rustdoc",
424# "rustfmt",
425# "rust-analyzer",
426# "rust-analyzer-proc-macro-srv",
427# "analysis",
428# "src",
429# "wasm-component-ld",
430# "miri", "cargo-miri" # for dev/nightly channels
431#]
432
433# Specify build configuration specific for some tool, such as enabled features.
434# This option has no effect on which tools are enabled: refer to the `tools` option for that.
435#
436# For example, to build Miri with tracing support, use `tool.miri.features = ["tracing"]`
437#
438# The default value for the `features` array is `[]`. However, please note that other flags in
439# `bootstrap.toml` might influence the features enabled for some tools. Also, enabling features
440# in tools which are not part of the internal "extra-features" preset might not always work.
441#build.tool.TOOL_NAME.features = [FEATURE1, FEATURE2]
442
443# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose, 3 == print environment variables on each rustc invocation
444#build.verbose = 0
445
446# Build the sanitizer runtimes
447#build.sanitizers = false
448
449# Build the profiler runtime (required when compiling with options that depend
450# on this runtime, such as `-C profile-generate` or `-C instrument-coverage`).
451#build.profiler = false
452
453# Use the optimized LLVM C intrinsics for `compiler_builtins`, rather than Rust intrinsics.
454# Choosing true requires the LLVM submodule to be managed by bootstrap (i.e. not external)
455# so that `compiler-rt` sources are available.
456#
457# Setting this to a path removes the requirement for a C toolchain, but requires setting the
458# path to an existing library containing the builtins library from LLVM's compiler-rt.
459#
460# Setting this to `false` generates slower code, but removes the requirement for a C toolchain in
461# order to run `x check`.
462#build.optimized-compiler-builtins = if rust.channel == "dev" { false } else { true }
463
464# Indicates whether the native libraries linked into Cargo will be statically
465# linked or not.
466#build.cargo-native-static = false
467
468# Run the build with low priority, by setting the process group's "nice" value
469# to +10 on Unix platforms, and by using a "low priority" job object on Windows.
470#build.low-priority = false
471
472# Arguments passed to the `./configure` script, used during distcheck. You
473# probably won't fill this in but rather it's filled in by the `./configure`
474# script. Useful for debugging.
475#build.configure-args = []
476
477# Indicates that a local rebuild is occurring instead of a full bootstrap,
478# essentially skipping stage0 as the local compiler is recompiling itself again.
479# Useful for modifying only the stage2 compiler without having to pass `--keep-stage 0` each time.
480#build.local-rebuild = false
481
482# Print out how long each bootstrap step took (mostly intended for CI and
483# tracking over time)
484#build.print-step-timings = false
485
486# Print out resource usage data for each bootstrap step, as defined by the Unix
487# struct rusage. (Note that this setting is completely unstable: the data it
488# captures, what platforms it supports, the format of its associated output, and
489# this setting's very existence, are all subject to change.)
490#build.print-step-rusage = false
491
492# Always patch binaries for usage with Nix toolchains. If `true` then binaries
493# will be patched unconditionally. If `false` or unset, binaries will be patched
494# only if the current distribution is NixOS. This option is useful when using
495# a Nix toolchain on non-NixOS distributions.
496#build.patch-binaries-for-nix = false
497
498# Collect information and statistics about the current build, and write it to
499# disk. Enabling this has no impact on the resulting build output. The
500# schema of the file generated by the build metrics feature is unstable, and
501# this is not intended to be used during local development.
502#build.metrics = false
503
504# Specify the location of the Android NDK. Used when targeting Android.
505#build.android-ndk = "/path/to/android-ndk-r26d"
506
507# Number of parallel jobs to be used for building and testing. If set to `0` or
508# omitted, it will be automatically determined. This is the `-j`/`--jobs` flag
509# passed to cargo invocations.
510#build.jobs = 0
511
512# What custom diff tool to use for displaying compiletest tests.
513#build.compiletest-diff-tool = <none>
514
515# Whether to allow `compiletest` self-tests and `compiletest`-managed test
516# suites to be run against the stage 0 rustc. This is only intended to be used
517# when the stage 0 compiler is actually built from in-tree sources.
518#build.compiletest-allow-stage0 = false
519
520# Default value for the `--extra-checks` flag of tidy.
521#
522# See `./x test tidy --help` for details.
523#
524# Note that if any value is manually given to bootstrap such as
525# `./x test tidy --extra-checks=js`, this value is ignored.
526# Use `--extra-checks=''` to temporarily disable all extra checks.
527#
528# Automatically enabled in the "tools" profile.
529# Set to the empty string to force disable (recommended for hdd systems).
530#build.tidy-extra-checks = ""
531
532# Indicates whether ccache is used when building certain artifacts (e.g. LLVM).
533# Set to `true` to use the first `ccache` in PATH, or set an absolute path to use
534# a specific version.
535#build.ccache = false
536
537# List of paths to exclude from the build and test processes.
538# For example, exclude = ["tests/ui", "src/tools/tidy"].
539#build.exclude = []
540
541# =============================================================================
542# General install configuration options
543# =============================================================================
544
545# Where to install the generated toolchain. Must be an absolute path.
546#install.prefix = "/usr/local"
547
548# Where to install system configuration files.
549# If this is a relative path, it will get installed in `prefix` above
550#install.sysconfdir = "/etc"
551
552# Where to install documentation in `prefix` above
553#install.docdir = "share/doc/rust"
554
555# Where to install binaries in `prefix` above
556#install.bindir = "bin"
557
558# Where to install libraries in `prefix` above
559#install.libdir = "lib"
560
561# Where to install man pages in `prefix` above
562#install.mandir = "share/man"
563
564# Where to install data in `prefix` above
565#install.datadir = "share"
566
567# =============================================================================
568# Options for compiling Rust code itself
569# =============================================================================
570
571# Whether or not to optimize when compiling the compiler and standard library,
572# and what level of optimization to use.
573# WARNING: Building with optimize = false is NOT SUPPORTED. Due to bootstrapping,
574# building without optimizations takes much longer than optimizing. Further, some platforms
575# fail to build without this optimization (c.f. #65352).
576# The valid options are:
577# true - Enable optimizations (same as 3).
578# false - Disable optimizations.
579# 0 - Disable optimizations.
580# 1 - Basic optimizations.
581# 2 - Some optimizations.
582# 3 - All optimizations.
583# "s" - Optimize for binary size.
584# "z" - Optimize for binary size, but also turn off loop vectorization.
585#rust.optimize = true
586
587# Indicates that the build should be configured for debugging Rust. A
588# `debug`-enabled compiler and standard library will be somewhat
589# slower (due to e.g. checking of debug assertions) but should remain
590# usable.
591#
592# Note: If this value is set to `true`, it will affect a number of
593# configuration options below as well, if they have been left
594# unconfigured in this file.
595#
596# Note: changes to the `debug` setting do *not* affect `optimize`
597# above. In theory, a "maximally debuggable" environment would
598# set `optimize` to `false` above to assist the introspection
599# facilities of debuggers like lldb and gdb. To recreate such an
600# environment, explicitly set `optimize` to `false` and `debug`
601# to `true`. In practice, everyone leaves `optimize` set to
602# `true`, because an unoptimized rustc with debugging
603# enabled becomes *unusably slow* (e.g. rust-lang/rust#24840
604# reported a 25x slowdown) and bootstrapping the supposed
605# "maximally debuggable" environment (notably libstd) takes
606# hours to build.
607#
608#rust.debug = false
609
610# Whether to download the stage 1 and 2 compilers from CI. This is useful if you
611# are working on tools, doc-comments, or library (you will be able to build the
612# standard library without needing to build the compiler).
613#
614# Set this to "if-unchanged" if you are working on `src/tools`, `tests` or
615# `library` (on CI, `library` changes triggers in-tree compiler build) to speed
616# up the build process if you don't need to build a compiler from the latest
617# commit from `master`.
618#
619# Set this to `true` to always download or `false` to always use the in-tree
620# compiler.
621#rust.download-rustc = false
622
623# Number of codegen units to use for each compiler invocation. A value of 0
624# means "the number of cores on this machine", and 1+ is passed through to the
625# compiler.
626#
627# Uses the rustc defaults: https://doc.rust-lang.org/rustc/codegen-options/index.html#codegen-units
628#rust.codegen-units = if incremental { 256 } else { 16 }
629
630# Sets the number of codegen units to build the standard library with,
631# regardless of what the codegen-unit setting for the rest of the compiler is.
632# NOTE: building with anything other than 1 is known to occasionally have bugs.
633#rust.codegen-units-std = codegen-units
634
635# Whether or not debug assertions are enabled for the compiler and standard library.
636# These can help find bugs at the cost of a small runtime slowdown.
637#
638# Defaults to rust.debug value
639#rust.debug-assertions = rust.debug (boolean)
640
641# Whether or not debug assertions are enabled for the standard library.
642# Overrides the `debug-assertions` option, if defined.
643#
644# Defaults to rust.debug-assertions value
645#rust.debug-assertions-std = rust.debug-assertions (boolean)
646
647# Whether or not debug assertions are enabled for the tools built by bootstrap.
648# Overrides the `debug-assertions` option, if defined.
649#
650# Defaults to rust.debug-assertions value
651#rust.debug-assertions-tools = rust.debug-assertions (boolean)
652
653# Whether or not to leave debug! and trace! calls in the rust binary.
654#
655# Defaults to rust.debug-assertions value
656#
657# If you see a message from `tracing` saying "some trace filter directives would enable traces that
658# are disabled statically" because `max_level_info` is enabled, set this value to `true`.
659#rust.debug-logging = rust.debug-assertions (boolean)
660
661# Whether or not to build rustc, tools and the libraries with randomized type layout
662#rust.randomize-layout = false
663
664# Whether or not overflow checks are enabled for the compiler and standard
665# library.
666#
667# Defaults to rust.debug value
668#rust.overflow-checks = rust.debug (boolean)
669
670# Whether or not overflow checks are enabled for the standard library.
671# Overrides the `overflow-checks` option, if defined.
672#
673# Defaults to rust.overflow-checks value
674#rust.overflow-checks-std = rust.overflow-checks (boolean)
675
676# Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`.
677# See https://doc.rust-lang.org/rustc/codegen-options/index.html#debuginfo for available options.
678#
679# Can be overridden for specific subsets of Rust code (rustc, std or tools).
680# Debuginfo for tests run with compiletest is not controlled by this option
681# and needs to be enabled separately with `debuginfo-level-tests`.
682#
683# Note that debuginfo-level = 2 generates several gigabytes of debuginfo
684# and will slow down the linking process significantly.
685#rust.debuginfo-level = if rust.debug { 1 } else { 0 }
686
687# Debuginfo level for the compiler.
688#rust.debuginfo-level-rustc = rust.debuginfo-level
689
690# Debuginfo level for the standard library.
691#rust.debuginfo-level-std = rust.debuginfo-level
692
693# Debuginfo level for the tools.
694#rust.debuginfo-level-tools = rust.debuginfo-level
695
696# Debuginfo level for the test suites run with compiletest.
697# FIXME(#61117): Some tests fail when this option is enabled.
698#rust.debuginfo-level-tests = 0
699
700# Should rustc and the standard library be built with split debuginfo? Default
701# is platform dependent.
702#
703# This field is deprecated, use `target.<triple>.split-debuginfo` instead.
704#
705# The value specified here is only used when targeting the `build.build` triple,
706# and is overridden by `target.<triple>.split-debuginfo` if specified.
707#
708#rust.split-debuginfo = see target.<triple>.split-debuginfo
709
710# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
711#rust.backtrace = true
712
713# Whether to always use incremental compilation when building rustc
714#rust.incremental = false
715
716# The default linker that will be hard-coded into the generated
717# compiler for targets that don't specify a default linker explicitly
718# in their target specifications. Note that this is not the linker
719# used to link said compiler. It can also be set per-target (via the
720# `[target.<triple>]` block), which may be useful in a cross-compilation
721# setting.
722#
723# See https://doc.rust-lang.org/rustc/codegen-options/index.html#linker for more information.
724#rust.default-linker = <none> (path)
725
726# The "channel" for the Rust build to produce. The stable/beta channels only
727# allow using stable features, whereas the nightly and dev channels allow using
728# nightly features.
729#
730# You can set the channel to "auto-detect" to load the channel name from `src/ci/channel`.
731#
732# If using tarball sources, default value is "auto-detect", otherwise, it's "dev".
733#rust.channel = if "is a tarball source" { "auto-detect" } else { "dev" }
734
735# The root location of the musl installation directory. The library directory
736# will also need to contain libunwind.a for an unwinding implementation. Note
737# that this option only makes sense for musl targets that produce statically
738# linked binaries.
739#
740# Defaults to /usr on musl hosts. Has no default otherwise.
741#rust.musl-root = <platform specific> (path)
742
743# By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix
744# platforms to ensure that the compiler is usable by default from the build
745# directory (as it links to a number of dynamic libraries). This may not be
746# desired in distributions, for example.
747#rust.rpath = true
748
749# Additional flags to pass to `rustc`.
750# Takes precedence over bootstrap's own flags but not over per target rustflags nor env. vars. like RUSTFLAGS.
751# Applies to all stages and targets.
752#
753#rust.rustflags = []
754
755# Indicates whether symbols should be stripped using `-Cstrip=symbols`.
756#rust.strip = false
757
758# Forces frame pointers to be used with `-Cforce-frame-pointers`.
759# This can be helpful for profiling at a small performance cost.
760#rust.frame-pointers = false
761
762# Indicates whether stack protectors should be used
763# via the unstable option `-Zstack-protector`.
764#
765# Valid options are : `none`(default),`basic`,`strong`, or `all`.
766# `strong` and `basic` options may be buggy and are not recommended, see rust-lang/rust#114903.
767#rust.stack-protector = "none"
768
769# Prints each test name as it is executed, to help debug issues in the test harness itself.
770#rust.verbose-tests = if is_verbose { true } else { false }
771
772# Flag indicating whether tests are compiled with optimizations (the -O flag).
773#rust.optimize-tests = true
774
775# Flag indicating whether codegen tests will be run or not. If you get an error
776# saying that the FileCheck executable is missing, you may want to disable this.
777# Also see the target's llvm-filecheck option.
778#rust.codegen-tests = true
779
780# Flag indicating whether git info will be retrieved from .git automatically.
781# Having the git information can cause a lot of rebuilds during development.
782#rust.omit-git-hash = if rust.channel == "dev" { true } else { false }
783
784# Whether to create a source tarball by default when running `x dist`.
785#
786# You can still build a source tarball when this is disabled by explicitly passing `x dist rustc-src`.
787#rust.dist-src = true
788
789# After building or testing an optional component (e.g. the nomicon or reference), append the
790# result (broken, compiling, testing) into this JSON file.
791#rust.save-toolstates = <none> (path)
792
793# This array serves three distinct purposes:
794# - Backends in this list will be automatically compiled and included in the sysroot of each
795# rustc compiled by bootstrap.
796# - The first backend in this list will be configured as the **default codegen backend** by each
797# rustc compiled by bootstrap. In other words, if the first backend is e.g. cranelift, then when
798# we build a stage 1 rustc, it will by default compile Rust programs using the Cranelift backend.
799# This also means that stage 2 rustc would get built by the Cranelift backend.
800# - Running `x dist` (without additional arguments, or with `--include-default-paths`) will produce
801# a dist component/tarball for the Cranelift backend if it is included in this array.
802#
803# Note that the LLVM codegen backend is special and will always be built and distributed.
804#
805# Currently, the only standard options supported here are `"llvm"`, `"cranelift"` and `"gcc"`.
806#rust.codegen-backends = ["llvm"]
807
808# Indicates whether LLD will be compiled and made available in the sysroot for rustc to execute,
809#rust.lld = false, except for targets that opt into LLD (see `target.default-linker-linux-override`)
810
811# Indicates if we should override the linker used to link Rust crates during bootstrap to be LLD.
812# If set to `true` or `"external"`, a global `lld` binary that has to be in $PATH
813# will be used.
814# If set to `"self-contained"`, rust-lld from the snapshot compiler will be used.
815#
816# On MSVC, LLD will not be used if we're cross linking.
817#
818# Explicitly setting the linker for a target will override this option when targeting MSVC.
819#rust.bootstrap-override-lld = false
820
821# Indicates whether some LLVM tools, like llvm-objdump, will be made available in the
822# sysroot.
823#rust.llvm-tools = true
824
825# Indicates whether the `self-contained` llvm-bitcode-linker, will be made available
826# in the sysroot. It is required for running nvptx tests.
827#rust.llvm-bitcode-linker = false
828
829# Whether to deny warnings in crates. Set to `false` to avoid
830# error: warnings are denied by `build.warnings` configuration
831#rust.deny-warnings = true
832
833# Print backtrace on internal compiler errors during bootstrap
834#rust.backtrace-on-ice = false
835
836# Whether to verify generated LLVM IR
837#rust.verify-llvm-ir = false
838
839# Compile the compiler with a non-default ThinLTO import limit. This import
840# limit controls the maximum size of functions imported by ThinLTO. Decreasing
841# will make code compile faster at the expense of lower runtime performance.
842#rust.thin-lto-import-instr-limit = if incremental { 10 } else { LLVM default (currently 100) }
843
844# Map debuginfo paths to `/rust/$sha/...`.
845# Useful for reproducible builds. Generally only set for releases
846#rust.remap-debuginfo = false
847
848# Link the compiler and LLVM against `jemalloc` instead of the default libc allocator.
849# This option is only tested on Linux and OSX. It can also be configured per-target in the
850# [target.<tuple>] section.
851#rust.jemalloc = false
852
853# Run tests in various test suites with the "nll compare mode" in addition to
854# running the tests in normal mode. Largely only used on CI and during local
855# development of NLL
856#rust.test-compare-mode = false
857
858# Global default for llvm-libunwind for all targets. See the target-specific
859# documentation for llvm-libunwind below. Note that the target-specific
860# option will override this if set.
861#rust.llvm-libunwind = 'no'
862
863# Enable Windows Control Flow Guard checks in the standard library.
864# This only applies from stage 1 onwards, and only for Windows targets.
865#rust.control-flow-guard = false
866
867# Enable Windows EHCont Guard checks in the standard library.
868# This only applies from stage 1 onwards, and only for Windows targets.
869#rust.ehcont-guard = false
870
871# Enable symbol-mangling-version v0. This can be helpful when profiling rustc,
872# as generics will be preserved in symbols (rather than erased into opaque T).
873# When no setting is given, the new scheme will be used when compiling the
874# compiler and its tools and the legacy scheme will be used when compiling the
875# standard library.
876# If an explicit setting is given, it will be used for all parts of the codebase.
877#rust.new-symbol-mangling = true|false (see comment)
878
879# Size limit in bytes for move/copy annotations (-Zannotate-moves). Only types
880# at or above this size will be annotated. If not specified, uses the default
881# limit (65 bytes).
882#rust.annotate-moves-size-limit = 65
883
884# Select LTO mode that will be used for compiling rustc. By default, thin local LTO
885# (LTO within a single crate) is used (like for any Rust crate). You can also select
886# "thin" or "fat" to apply Thin/Fat LTO to the `rustc_driver` dylib, or "off" to disable
887# LTO entirely.
888#rust.lto = "thin-local"
889
890# Build compiler with the optimization enabled and -Zvalidate-mir, currently only for `std`
891#rust.validate-mir-opts = 3
892
893# Configure `std` features used during bootstrap.
894#
895# Default features will be expanded in the following cases:
896# - If `rust.llvm-libunwind` or `target.llvm-libunwind` is enabled:
897# - "llvm-libunwind" will be added for in-tree LLVM builds.
898# - "system-llvm-libunwind" will be added for system LLVM builds.
899# - If `rust.backtrace` is enabled, "backtrace" will be added.
900# - If `rust.profiler` or `target.profiler` is enabled, "profiler" will be added.
901# - If building for a zkvm target, "compiler-builtins-mem" will be added.
902#
903# Since libstd also builds libcore and liballoc as dependencies and all their features are mirrored
904# as libstd features, this option can also be used to configure features such as optimize_for_size.
905#rust.std-features = ["panic_unwind"]
906
907# Trigger a `DebugBreak` after an internal compiler error during bootstrap on Windows
908#rust.break-on-ice = true
909
910# Set the number of threads for the compiler frontend used during compilation of Rust code (passed to `-Zthreads`).
911# The valid options are:
912# 0 - Set the number of threads according to the detected number of threads of the host system
913# 1 - Use a single thread for compilation of Rust code (the default)
914# N - Number of threads used for compilation of Rust code
915#
916#rust.parallel-frontend-threads = 1
917
918# =============================================================================
919# Distribution options
920#
921# These options are related to distribution, mostly for the Rust project itself.
922# You probably won't need to concern yourself with any of these options
923# =============================================================================
924
925# This is the folder of artifacts that the build system will sign. All files in
926# this directory will be signed with the default gpg key using the system `gpg`
927# binary. The `asc` and `sha256` files will all be output into the standard dist
928# output folder (currently `build/dist`)
929#
930# This folder should be populated ahead of time before the build system is
931# invoked.
932#dist.sign-folder = <none> (path)
933
934# The remote address that all artifacts will eventually be uploaded to. The
935# build system generates manifests which will point to these urls, and for the
936# manifests to be correct they'll have to have the right URLs encoded.
937#
938# Note that this address should not contain a trailing slash as file names will
939# be appended to it.
940#dist.upload-addr = <none> (URL)
941
942# Whether to build a plain source tarball to upload
943# We disable that on Windows not to override the one already uploaded on S3
944# as the one built on Windows will contain backslashes in paths causing problems
945# on linux
946#dist.src-tarball = true
947
948# List of compression formats to use when generating dist tarballs. The list of
949# formats is provided to rust-installer, which must support all of them.
950#
951# This list must be non-empty.
952#dist.compression-formats = ["gz", "xz"]
953
954# How much time should be spent compressing the tarballs. The better the
955# compression profile, the longer compression will take.
956#
957# Available options: fast, balanced, best
958#dist.compression-profile = "fast"
959
960# Copy the linker, DLLs, and various libraries from MinGW into the Rust toolchain.
961# Only applies when the host or target is pc-windows-gnu.
962#dist.include-mingw-linker = true
963
964# Whether to vendor dependencies for the dist tarball.
965#dist.vendor = if "is a tarball source" || "is a git repository" { true } else { false }
966
967
968# =============================================================================
969# Options for specific targets
970#
971# Each of the following options is scoped to the specific target triple in
972# question and is used for determining how to compile each target.
973# =============================================================================
974[target.x86_64-unknown-linux-gnu]
975
976# C compiler to be used to compile C code. Note that the
977# default value is platform specific, and if not specified it may also depend on
978# what platform is crossing to what platform.
979# See `src/bootstrap/src/utils/cc_detect.rs` for details.
980#cc = "cc" (path)
981
982# C++ compiler to be used to compile C++ code (e.g. LLVM and our LLVM shims).
983# This is only used for host targets.
984# See `src/bootstrap/src/utils/cc_detect.rs` for details.
985#cxx = "c++" (path)
986
987# Archiver to be used to assemble static libraries compiled from C/C++ code.
988# Note: an absolute path should be used, otherwise LLVM build will break.
989#ar = "ar" (path)
990
991# Ranlib to be used to assemble static libraries compiled from C/C++ code.
992# Note: an absolute path should be used, otherwise LLVM build will break.
993#ranlib = "ranlib" (path)
994
995# Linker to be used to bootstrap Rust code. Note that the
996# default value is platform specific, and if not specified it may also depend on
997# what platform is crossing to what platform.
998# Setting this will override the `bootstrap-override-lld` option for Rust code when targeting MSVC.
999#linker = "cc" (path)
1000
1001# Should rustc and the standard library be built with split debuginfo? Default
1002# is platform dependent.
1003#
1004# Valid values are the same as those accepted by `-C split-debuginfo`
1005# (`off`/`unpacked`/`packed`).
1006#
1007# On Linux, split debuginfo is disabled by default.
1008#
1009# On Apple platforms, unpacked split debuginfo is used by default. Unpacked
1010# debuginfo does not run `dsymutil`, which packages debuginfo from disparate
1011# object files into a single `.dSYM` file. `dsymutil` adds time to builds for
1012# no clear benefit, and also makes it more difficult for debuggers to find
1013# debug info. The compiler currently defaults to running `dsymutil` to preserve
1014# its historical default, but when compiling the compiler itself, we skip it by
1015# default since we know it's safe to do so in that case.
1016#
1017# On Windows MSVC platforms, packed debuginfo is the only supported option,
1018# producing a `.pdb` file. On Windows GNU rustc doesn't support splitting debuginfo,
1019# and enabling it causes issues.
1020#split-debuginfo = if linux || windows-gnu { off } else if windows-msvc { packed } else if apple { unpacked }
1021
1022# Path to the `llvm-config` binary of the installation of a custom LLVM to link
1023# against. Note that if this is specified we don't compile LLVM at all for this
1024# target.
1025#llvm-config = <none> (path)
1026
1027# Override detection of whether this is a Rust-patched LLVM. This would be used
1028# in conjunction with either an llvm-config or build.submodules = false.
1029#llvm-has-rust-patches = if llvm-config { false } else { true }
1030
1031# Normally the build system can find LLVM's FileCheck utility, but if
1032# not, you can specify an explicit file name for it.
1033#llvm-filecheck = "/path/to/llvm-version/bin/FileCheck"
1034
1035# Use LLVM libunwind as the implementation for Rust's unwinder.
1036# Accepted values are 'in-tree' (formerly true), 'system' or 'no' (formerly false).
1037# This option only applies for Linux and Fuchsia targets.
1038# On Linux target, if crt-static is not enabled, 'no' means dynamic link to
1039# `libgcc_s.so`, 'in-tree' means static link to the in-tree build of llvm libunwind
1040# and 'system' means dynamic link to `libunwind.so`. If crt-static is enabled,
1041# the behavior is depend on the libc. On musl target, 'no' and 'in-tree' both
1042# means static link to the in-tree build of llvm libunwind, and 'system' means
1043# static link to `libunwind.a` provided by system. Due to the limitation of glibc,
1044# it must link to `libgcc_eh.a` to get a working output, and this option have no effect.
1045#llvm-libunwind = 'no' if Linux, 'in-tree' if Fuchsia
1046
1047# Build the sanitizer runtimes for this target.
1048# This option will override the same option under [build] section.
1049#sanitizers = build.sanitizers (bool)
1050
1051# When true, build the profiler runtime for this target (required when compiling
1052# with options that depend on this runtime, such as `-C profile-generate` or
1053# `-C instrument-coverage`). This may also be given a path to an existing build
1054# of the profiling runtime library from LLVM's compiler-rt.
1055# This option will override the same option under [build] section.
1056#profiler = build.profiler (bool)
1057
1058# This option supports enable `rpath` in each target independently,
1059# and will override the same option under [rust] section. It only works on Unix platforms
1060#rpath = rust.rpath (bool)
1061
1062# Additional flags to pass to `rustc`.
1063# Takes precedence over bootstrap's own flags and `rust.rustflags` but not over env. vars. like RUSTFLAGS.
1064# Applies to all stages.
1065#
1066#rustflags = rust.rustflags
1067
1068# Force static or dynamic linkage of the standard library for this target. If
1069# this target is a host for rustc, this will also affect the linkage of the
1070# compiler itself. This is useful for building rustc on targets that normally
1071# only use static libraries. If unset, the target's default linkage is used.
1072#crt-static = <platform-specific> (bool)
1073
1074# The root location of the musl installation directory. The library directory
1075# will also need to contain libunwind.a for an unwinding implementation. Note
1076# that this option only makes sense for musl targets that produce statically
1077# linked binaries.
1078#musl-root = build.musl-root (path)
1079
1080# The full path to the musl libdir.
1081#musl-libdir = musl-root/lib
1082
1083# The root location of the `wasm32-wasip1` sysroot. Only used for WASI
1084# related targets. Make sure to create a `[target.wasm32-wasip1]`
1085# section and move this field there (or equivalent for the target being built).
1086#wasi-root = <none> (path)
1087
1088# Used in testing for configuring where the QEMU images are located, you
1089# probably don't want to use this.
1090#qemu-rootfs = <none> (path)
1091
1092# Skip building the `std` library for this target. Enabled by default for
1093# target triples containing `-none`, `nvptx`, `switch`, or `-uefi`.
1094#no-std = <platform-specific> (bool)
1095
1096# This is an array of the codegen backends that will be
1097# compiled for this target, overriding the global rust.codegen-backends option.
1098# See that option for more info.
1099#codegen-backends = rust.codegen-backends (array)
1100
1101# This is a "runner" to pass to `compiletest` when executing tests. Tests will
1102# execute this tool where the binary-to-test is passed as an argument. Can
1103# be useful for situations such as when WebAssembly is being tested and a
1104# runtime needs to be configured. This value is similar to
1105# Cargo's `CARGO_$target_RUNNER` configuration.
1106#
1107# This configuration is a space-separated list of arguments so `foo bar` would
1108# execute the program `foo` with the first argument as `bar` and the second
1109# argument as the test binary.
1110#runner = <none> (string)
1111
1112# Use the optimized LLVM C intrinsics for `compiler_builtins`, rather than Rust intrinsics
1113# on this target. Choosing true requires the LLVM submodule to be managed by bootstrap
1114# (i.e. not external) so that `compiler-rt` sources are available.
1115#
1116# Setting this to a path removes the requirement for a C toolchain, but requires setting the
1117# path to an existing library containing the builtins library from LLVM's compiler-rt.
1118#
1119# Setting this to `false` generates slower code, but removes the requirement for a C toolchain in
1120# order to run `x check`.
1121#optimized-compiler-builtins = build.optimized-compiler-builtins (bool or path)
1122
1123# Link the compiler and LLVM against `jemalloc` instead of the default libc allocator.
1124# This overrides the global `rust.jemalloc` option. See that option for more info.
1125#jemalloc = rust.jemalloc (bool)
1126
1127# The linker configuration that will *override* the default linker used for Linux
1128# targets in the built compiler.
1129#
1130# The following values are supported:
1131# - `off` => do not apply any override and use the default linker. This can be used to opt out of
1132# linker overrides set by bootstrap for specific targets (see below).
1133# - `self-contained-lld-cc` => override the default linker to be self-contained LLD (`rust-lld`)
1134# that is invoked through `cc`.
1135#
1136# Currently, the following targets automatically opt into the self-contained LLD linker, unless you
1137# pass `off`:
1138# - x86_64-unknown-linux-gnu
1139#default-linker-linux-override = "off" (for most targets)