Skip to content

Make combining LLD with external LLVM config a hard error #143175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 1, 2025

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Jun 29, 2025

Younger me made this only a warning in #139853, because our post-dist tests were relying on this. But that was not a good idea, because there are a bunch of places in bootstrap that outright try to build LLD/copy LLD to sysroot when lld_enabled is true (rightfully so), which is causing issues (#143076). Instead of piling more hacks, I'd like to just disallow this, and if we need to use a hack, do it only for our CI.

If this breaks the CI post-dist tests, I'll either add some special environment variable for it, or, as an alternative, make the error back into a warning, but also disable lld_enabled when this situation happens.

try-job: dist-x86_64-linux

Fixes: #143175

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jun 29, 2025
@Kobzol
Copy link
Contributor Author

Kobzol commented Jun 29, 2025

@bors2 try

@rust-bors
Copy link

rust-bors bot commented Jun 29, 2025

⌛ Trying commit 1a8b6f5 with merge 3d62165

To cancel the try build, run the command @bors2 try cancel.

rust-bors bot added a commit that referenced this pull request Jun 29, 2025
…<try>

Make combining LLD with external LLVM config a hard error

Younger me made this only a warning in #139853, because our post-dist tests were relying on this. But that was not a good idea, because there are a bunch of places in bootstrap that outright try to build LLD/copy LLD to sysroot when `lld_enabled` is true (rightfully so), which is causing issues (#143076). Instead of piling more hacks, I'd like to just disallow this, and use hack to make our CI work instead.

If this breaks the CI post-dist tests, I'll either add some special environment variable for it, or, as an alternative, make the error back into a warning, but also disable `lld_enabled` when this situation happens.

try-job: dist-x86_64-linux
@rust-bors
Copy link

rust-bors bot commented Jun 29, 2025

☀️ Try build successful (CI)
Build commit: 3d62165 (3d62165fe20264f8403084c6c43aaf4bcb1658c9, parent: dddd7ab96229ea5f2ca96afcb5984a9831393a13)

@Kobzol
Copy link
Contributor Author

Kobzol commented Jun 30, 2025

I checked that this executes the same number of tests as before. Looks like just disabling LLD for post-dist tests in bootstrap works! 🎉

r? @jieyouxu

@rustbot
Copy link
Collaborator

rustbot commented Jun 30, 2025

jieyouxu is not on the review rotation at the moment.
They may take a while to respond.

@Kobzol Kobzol marked this pull request as ready for review June 30, 2025 11:30
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 30, 2025

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

Some changes occurred in src/tools/opt-dist

cc @Kobzol

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I think this makes sense. I'd also rather hard error on this combination instead of trying to do some... implicit magic.

Can you add a change tracker entry for this? Feel free to r=me after.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 30, 2025
@Kobzol
Copy link
Contributor Author

Kobzol commented Jun 30, 2025

@bors r=Jieyouxu rollup

@bors
Copy link
Collaborator

bors commented Jun 30, 2025

📌 Commit 5cf2a50 has been approved by Jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 30, 2025
rust-bors bot added a commit that referenced this pull request Jun 30, 2025
Do not enable LLD by default in the dist profile

History of us building & shipping LLD for `dist` builds:
1) We used to unconditionally build & ship LLD in bootstrap
2) This was causing problems for people doing custom `dist` builds (https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)
3) #126701 made shipping of LLD optional, but to preserve previous behavior, it forcefully enabled `rust.lld = true` in the `dist` profile by default, and overwrote the default to `false` on our CI for external LLVM builds.
    - This also didn't match the documentation of `rust.lld` in `bootstrap.example.toml`, which I previously missed.
4) However, since the external LLVM opt-out was only implemented for our CI, and not for all `dist` users, this started causing issues for people `dist`ing with external LLVM (#143076). The problem is that the default shouldn't be "true", but "LLD is enabled when LLVM isn't external", but this is not possible to do only in TOML.

So this PR reverses the behavior. LLD is not enabled by default in `dist` anymore. We switch our CI to *opt into* disting LLD, unless an external LLVM is used. External `dist` users can still opt into enabling LLD, but if they do so while also using external LLVM, they will now get a [hard error](#143175).

r? `@jieyouxu`

try-job: x86_64-mingw
try-job: dist-x86_64-linux
rust-bors bot added a commit that referenced this pull request Jun 30, 2025
Do not enable LLD by default in the dist profile

History of us building & shipping LLD for `dist` builds:
1) We used to unconditionally build & ship LLD in bootstrap
2) This was causing problems for people doing custom `dist` builds (https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)
3) #126701 made shipping of LLD optional, but to preserve previous behavior, it forcefully enabled `rust.lld = true` in the `dist` profile by default, and overwrote the default to `false` on our CI for external LLVM builds.
    - This also didn't match the documentation of `rust.lld` in `bootstrap.example.toml`, which I previously missed.
4) However, since the external LLVM opt-out was only implemented for our CI, and not for all `dist` users, this started causing issues for people `dist`ing with external LLVM (#143076). The problem is that the default shouldn't be "true", but "LLD is enabled when LLVM isn't external", but this is not possible to do only in TOML.

So this PR reverses the behavior. LLD is not enabled by default in `dist` anymore. We switch our CI to *opt into* disting LLD, unless an external LLVM is used. External `dist` users can still opt into enabling LLD, but if they do so while also using external LLVM, they will now get a [hard error](#143175).

r? `@jieyouxu`

try-job: `x86_64-mingw*`
try-job: dist-x86_64-linux
bors added a commit that referenced this pull request Jun 30, 2025
Rollup of 9 pull requests

Successful merges:

 - #143019 (Ensure -V --verbose processes both codegen_backend and codegen-backend)
 - #143140 (give Pointer::into_parts a more scary name and offer a safer alternative)
 - #143175 (Make combining LLD with external LLVM config a hard error)
 - #143180 (Use `tracing-forest` instead of `tracing-tree` for bootstrap tracing)
 - #143223 (Improve macro stats printing)
 - #143228 (Handle build scripts better in `-Zmacro-stats` output.)
 - #143229 ([COMPILETEST-UNTANGLE 1/N] Move some some early config checks to the lib and move the compiletest binary)
 - #143246 (Subtree update of `rust-analyzer`)
 - #143248 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1be0c62 into rust-lang:master Jul 1, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 1, 2025
rust-timer added a commit that referenced this pull request Jul 1, 2025
Rollup merge of #143175 - Kobzol:bootstrap-lld-external-llvm-config, r=Jieyouxu

Make combining LLD with external LLVM config a hard error

Younger me made this only a warning in #139853, because our post-dist tests were relying on this. But that was not a good idea, because there are a bunch of places in bootstrap that outright try to build LLD/copy LLD to sysroot when `lld_enabled` is true (rightfully so), which is causing issues (#143076). Instead of piling more hacks, I'd like to just disallow this, and if we need to use a hack, do it only for our CI.

If this breaks the CI post-dist tests, I'll either add some special environment variable for it, or, as an alternative, make the error back into a warning, but also disable `lld_enabled` when this situation happens.

try-job: dist-x86_64-linux

Fixes: #143175
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jul 1, 2025
…r=Jieyouxu

Make combining LLD with external LLVM config a hard error

Younger me made this only a warning in rust-lang/rust#139853, because our post-dist tests were relying on this. But that was not a good idea, because there are a bunch of places in bootstrap that outright try to build LLD/copy LLD to sysroot when `lld_enabled` is true (rightfully so), which is causing issues (rust-lang/rust#143076). Instead of piling more hacks, I'd like to just disallow this, and if we need to use a hack, do it only for our CI.

If this breaks the CI post-dist tests, I'll either add some special environment variable for it, or, as an alternative, make the error back into a warning, but also disable `lld_enabled` when this situation happens.

try-job: dist-x86_64-linux

Fixes: rust-lang/rust#143175
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jul 1, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143019 (Ensure -V --verbose processes both codegen_backend and codegen-backend)
 - rust-lang/rust#143140 (give Pointer::into_parts a more scary name and offer a safer alternative)
 - rust-lang/rust#143175 (Make combining LLD with external LLVM config a hard error)
 - rust-lang/rust#143180 (Use `tracing-forest` instead of `tracing-tree` for bootstrap tracing)
 - rust-lang/rust#143223 (Improve macro stats printing)
 - rust-lang/rust#143228 (Handle build scripts better in `-Zmacro-stats` output.)
 - rust-lang/rust#143229 ([COMPILETEST-UNTANGLE 1/N] Move some some early config checks to the lib and move the compiletest binary)
 - rust-lang/rust#143246 (Subtree update of `rust-analyzer`)
 - rust-lang/rust#143248 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
@Kobzol Kobzol deleted the bootstrap-lld-external-llvm-config branch July 1, 2025 05:43
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jul 1, 2025
…ieyouxu

Do not enable LLD by default in the dist profile

History of us building & shipping LLD for `dist` builds:
1) We used to unconditionally build & ship LLD in bootstrap
2) This was causing problems for people doing custom `dist` builds (https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)
3) rust-lang#126701 made shipping of LLD optional, but to preserve previous behavior, it forcefully enabled `rust.lld = true` in the `dist` profile by default, and overwrote the default to `false` on our CI for external LLVM builds.
    - This also didn't match the documentation of `rust.lld` in `bootstrap.example.toml`, which I previously missed.
4) However, since the external LLVM opt-out was only implemented for our CI, and not for all `dist` users, this started causing issues for people `dist`ing with external LLVM (rust-lang#143076). The problem is that the default shouldn't be "true", but "LLD is enabled when LLVM isn't external", but this is not possible to do only in TOML.

So this PR reverses the behavior. LLD is not enabled by default in `dist` anymore. We switch our CI to *opt into* disting LLD, unless an external LLVM is used. External `dist` users can still opt into enabling LLD, but if they do so while also using external LLVM, they will now get a [hard error](rust-lang#143175).

r? `@jieyouxu`

try-job: `x86_64-mingw*`
try-job: dist-x86_64-linux
rust-timer added a commit that referenced this pull request Jul 1, 2025
Rollup merge of #143255 - Kobzol:disable-lld-by-default, r=jieyouxu

Do not enable LLD by default in the dist profile

History of us building & shipping LLD for `dist` builds:
1) We used to unconditionally build & ship LLD in bootstrap
2) This was causing problems for people doing custom `dist` builds (https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)
3) #126701 made shipping of LLD optional, but to preserve previous behavior, it forcefully enabled `rust.lld = true` in the `dist` profile by default, and overwrote the default to `false` on our CI for external LLVM builds.
    - This also didn't match the documentation of `rust.lld` in `bootstrap.example.toml`, which I previously missed.
4) However, since the external LLVM opt-out was only implemented for our CI, and not for all `dist` users, this started causing issues for people `dist`ing with external LLVM (#143076). The problem is that the default shouldn't be "true", but "LLD is enabled when LLVM isn't external", but this is not possible to do only in TOML.

So this PR reverses the behavior. LLD is not enabled by default in `dist` anymore. We switch our CI to *opt into* disting LLD, unless an external LLVM is used. External `dist` users can still opt into enabling LLD, but if they do so while also using external LLVM, they will now get a [hard error](#143175).

r? `@jieyouxu`

try-job: `x86_64-mingw*`
try-job: dist-x86_64-linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants