You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rustc built for custom targets requires -Zunstable-options on every invocation #155963
When building rustc with support for custom targets, the compiler requires the -Zunstable-options flag not only during the build process but also on every subsequent invocation of the resulting rustc binary.
For e.g., rustc -vV -Zunstable-options
This behavior introduces additional complexity for cross-compilation toolchains (e.g., Yocto Project), where custom targets are distributed as part of the toolchain. End users of such toolchains are required to consistently pass -Zunstable-options, even for basic commands, which reduces usability.
To mitigate this, we are forced to introduce a wrapper script around rustc to automatically inject the -Zunstable-options flag. However, this is not an ideal or maintainable solution.
Can the requirement to pass -Zunstable-options be limited to the build phase and once a rustc binary is built for a custom target, invoking it should not require this flag for standard operations?
Are you using json target specs? If so you might want to patch rustc to add a builtin target instead. See for example how LibreELEC did it: LibreELEC/LibreELEC.tv#11205
The same process would then need to be repeated across at least five additional architectures (arm, arm64, riscv64...)
In addition, Yocto is designed to support highly customized Linux distributions, where users commonly define their own target naming conventions. As a result, this approach would effectively require end users themselves to register and maintain their custom targets. For example:
x86-64_wrs-linux-gnu
aarch64_wrs-linux-gnu
These may further vary depending on their distribution.
As a result, the number of possible targets is effectively unbounded. Because of this, relying on target registration does not appear to be a scalable or practical solution for us.
We also explored using a wrapper function to automatically pass -Zunstable-options when invoking rustc as a workaround. However, this approach has several limitations within our project's sdk environment, making it unsuitable for adoption.
Given these constraints, would it be possible to limit the -Zunstable-options requirement specifically to cases where rustc is invoked to build for a custom target JSON file, rather than requiring it for all invocations?
For example:
./rustc --target custom-target.json -Zunstable-options # Here the -Zunstable-options required
./rustc -vV # Here the -Zunstable-options not required
Activity
DeepeshWR commentedon Apr 29, 2026
@davidtwco @ehuss
bjorn3 commentedon Apr 29, 2026
Are you using json target specs? If so you might want to patch rustc to add a builtin target instead. See for example how LibreELEC did it: LibreELEC/LibreELEC.tv#11205
DeepeshWR commentedon May 8, 2026
Thanks @bjorn3
As you pointed out, we can work around this issue through target registration, but there is a scalability limitation with that approach.
Even for the x86-64 architecture alone, we already maintain four different target combinations:
The same process would then need to be repeated across at least five additional architectures (arm, arm64, riscv64...)
In addition, Yocto is designed to support highly customized Linux distributions, where users commonly define their own target naming conventions. As a result, this approach would effectively require end users themselves to register and maintain their custom targets. For example:
These may further vary depending on their distribution.
As a result, the number of possible targets is effectively unbounded. Because of this, relying on target registration does not appear to be a scalable or practical solution for us.
We also explored using a wrapper function to automatically pass
-Zunstable-optionswhen invoking rustc as a workaround. However, this approach has several limitations within our project's sdk environment, making it unsuitable for adoption.Given these constraints, would it be possible to limit the
-Zunstable-optionsrequirement specifically to cases where rustc is invoked to build for a custom target JSON file, rather than requiring it for all invocations?For example:
@davidtwco
Any suggestions on this approach?
rust: Upgrade 1.94.1 -> 1.95.0
rust: Upgrade 1.94.1 -> 1.95.0
rust: Upgrade 1.97.1 -> 1.98.0
rust: Upgrade 1.97.1 -> 1.98.0
rust: Upgrade 1.97.1 -> 1.98.0
rust: Upgrade 1.97.1 -> 1.98.0