Skip to content
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

custom/external clippy support for bootstrapping #129152

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

onur-ozkan
Copy link
Member

Similar to cargo, rustc, and rustfmt, this adds the support of using custom clippy on bootstrap. It’s designed for those who want to test their own clippy builds or avoid downloading the stage0 clippy.

Closes #121518

@rustbot
Copy link
Collaborator

rustbot commented Aug 16, 2024

r? @Kobzol

rustbot has assigned @Kobzol.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Aug 16, 2024
@rustbot
Copy link
Collaborator

rustbot commented Aug 16, 2024

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

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

This PR modifies config.example.toml.

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

@onur-ozkan onur-ozkan force-pushed the custom-clippy branch 2 times, most recently from d54b4dd to 4fe847a Compare August 16, 2024 11:55
@Kobzol
Copy link
Contributor

Kobzol commented Aug 17, 2024

PR looks good, but when I tried this locally with a stable version of clippy, it failed:

Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.03s
There have been changes to x.py since you last updated:
  [INFO] New options `build.cargo-clippy` and `build.clippy-driver` added for supporting the use of custom/external clippy
    - PR Link https://github.com/rust-lang/rust/pull/129152
NOTE: to silence this warning, update `config.toml` to use `change-id = 129152` instead
Installing external clippy to stage0 sysroot.
Linting stage0 library {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (x86_64-unknown-linux-gnu)
/projects/personal/rust/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo-clippy: error while loading shared libraries: librustc_driver-a30ca400d2857f33.so: cannot open shared object file: No such file or directory

a30ca400d2857f33 is the version from my stable toolchain.

The problem seems to be that the cargo clippy binaries from the distributed toolchains are looking for librustc_driver.so and libstd.so using relative paths, so after being copied out, it no longer works.

(venv) /pr/pe/ru/rust [custom-clippy/u]$ ldd build/x86_64-unknown-linux-gnu/stage0/bin/cargo-clippy 
        linux-vdso.so.1 (0x00007fff52583000)
        librustc_driver-a30ca400d2857f33.so => not found
        libstd-52417a9a08ba8fb9.so => not found
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1c7ed6e000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1c7ed69000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1c7ec82000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1c7ea57000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1c7eec6000)

The same is true for rustc, if I copy it e.g. to /tmp, it stops working.
However, if I set build.rustc, it works even with the rustc from the stable toolchain. So maybe bootstrap does something more in that case?

@onur-ozkan
Copy link
Member Author

onur-ozkan commented Aug 17, 2024

The problem seems to be that the cargo clippy binaries from the distributed toolchains are looking for librustc_driver.so and libstd.so using relative paths, so after being copied out, it no longer works.

Hmm.. I only tried it with the beta clippy and it worked fine.

The same is true for rustc, if I copy it e.g. to /tmp, it stops working.
However, if I set build.rustc, it works even with the rustc from the stable toolchain. So maybe bootstrap does something more in that case?

For rustc we are passing its path in cargo environment variable, which is not possible for clippy unfortunately.

@onur-ozkan
Copy link
Member Author

@rustbot author

@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 Aug 22, 2024
@onur-ozkan onur-ozkan added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Aug 23, 2024
tgross35 added a commit to tgross35/rust that referenced this pull request Aug 25, 2024
…=Kobzol

handle stage0 `cargo` and `rustc` separately

This change allows setting either `build.cargo` or `build.rustc` without requiring both to be set simultaneously, which was not possible previously.

To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build.

Blocker for rust-lang#129152
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 25, 2024
…=Kobzol

handle stage0 `cargo` and `rustc` separately

This change allows setting either `build.cargo` or `build.rustc` without requiring both to be set simultaneously, which was not possible previously.

To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build.

Blocker for rust-lang#129152
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 25, 2024
…=Kobzol

handle stage0 `cargo` and `rustc` separately

This change allows setting either `build.cargo` or `build.rustc` without requiring both to be set simultaneously, which was not possible previously.

To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build.

Blocker for rust-lang#129152
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 25, 2024
…=Kobzol

handle stage0 `cargo` and `rustc` separately

This change allows setting either `build.cargo` or `build.rustc` without requiring both to be set simultaneously, which was not possible previously.

To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build.

Blocker for rust-lang#129152
@bors
Copy link
Contributor

bors commented Aug 25, 2024

☔ The latest upstream changes (presumably #129295) made this pull request unmergeable. Please resolve the merge conflicts.

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 25, 2024
Rollup merge of rust-lang#129459 - onur-ozkan:separate-stage0-bins, r=Kobzol

handle stage0 `cargo` and `rustc` separately

This change allows setting either `build.cargo` or `build.rustc` without requiring both to be set simultaneously, which was not possible previously.

To try it, set `build.rustc` without setting `build.cargo`, and try to bootstrap on clean build.

Blocker for rust-lang#129152
Similar to cargo, rustc, and rustfmt, this adds the support of using custom clippy on bootstrap.
It’s designed for those who want to test their own clippy builds or avoid downloading the stage0 clippy.

Signed-off-by: onur-ozkan <[email protected]>
@onur-ozkan
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Aug 26, 2024
@Kobzol
Copy link
Contributor

Kobzol commented Sep 2, 2024

Thank you!

@bors r+

@bors
Copy link
Contributor

bors commented Sep 2, 2024

📌 Commit 1a991e5 has been approved by Kobzol

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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 2, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 2, 2024
custom/external clippy support for bootstrapping

Similar to cargo, rustc, and rustfmt, this adds the support of using custom clippy on bootstrap. It’s designed for those who want to test their own clippy builds or avoid downloading the stage0 clippy.

Closes rust-lang#121518
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 2, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#129152 (custom/external clippy support for bootstrapping)
 - rust-lang#129529 (Add test to build crates used by r-a on stable)
 - rust-lang#129829 (Make decoding non-optional `LazyArray` panic if not set)
 - rust-lang#129860 (update `object` dependency to remove duplicate `wasmparser`)
 - rust-lang#129875 (chore: Fix typos in 'compiler' (batch 1))
 - rust-lang#129877 (chore: Fix typos in 'compiler' (batch 2))
 - rust-lang#129878 (chore: Fix typos in 'compiler' (batch 3))
 - rust-lang#129891 (Do not request sanitizers for naked functions)
 - rust-lang#129892 (Clarify language around ptrs in slice::raw)

Failed merges:

 - rust-lang#129777 (Add `unreachable_pub`, round 4)
 - rust-lang#129868 (Remove kobzol vacation status)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 3, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#129152 (custom/external clippy support for bootstrapping)
 - rust-lang#129311 (don't copy `.rustc-dev-contents` from CI rustc)
 - rust-lang#129800 (Move the Windows remove_dir_all impl into a module and make it more race resistant)
 - rust-lang#129860 (update `object` dependency to remove duplicate `wasmparser`)
 - rust-lang#129885 (chore: remove repetitive words)
 - rust-lang#129913 (Add missing read_buf stub for x86_64-unknown-l4re-uclibc)
 - rust-lang#129916 (process.rs: remove "Basic usage" text where not useful)
 - rust-lang#129917 (Fix parsing of beta version in dry-run mode)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 11398ed into rust-lang:master Sep 3, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 3, 2024
Rollup merge of rust-lang#129152 - onur-ozkan:custom-clippy, r=Kobzol

custom/external clippy support for bootstrapping

Similar to cargo, rustc, and rustfmt, this adds the support of using custom clippy on bootstrap. It’s designed for those who want to test their own clippy builds or avoid downloading the stage0 clippy.

Closes rust-lang#121518
@onur-ozkan onur-ozkan deleted the custom-clippy branch September 5, 2024 05:33
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.

bootstrap: custom clippy
4 participants