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

Make the libstd build script smaller #78924

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Nov 10, 2020

Of all sysroot crates currently only compiler_builtins, miniz_oxide and std require a build script. compiler_builtins uses to conditionally enable certain features and possibly compile a C version (source), miniz_oxide only uses it to detect if liballoc is supported as the MSRV is 1.34.0 instead of the 1.36.0 which stabilized liballoc (source). std now only uses it to enable freebsd12 when the RUST_STD_FREEBSD_12_ABI env var is set, to determine if restricted-std should be set, to set the STD_ENV_ARCH env var identical to CARGO_CFG_TARGET_ARCH, and to unconditionally enable backtrace_in_libstd.

If all build scripts were to be removed, it would be possible for rustc to completely compile it's own sysroot. It currently requires a rustc version that already has an available libstd to compile the build scripts. If rustc can completely compile it's own sysroot, rustbuild could be simplified to not forcefully use the bootstrap compiler for build scripts.

@rustbot modify labels: +T-compiler +libs-impl

@rustbot
Copy link
Collaborator

rustbot commented Nov 10, 2020

Error: Label libs-impl can only be set by Rust team members

Please let @rust-lang/release know if you're having trouble with this bot.

@rust-highfive
Copy link
Collaborator

r? @KodrAus

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 10, 2020
@bjorn3
Copy link
Member Author

bjorn3 commented Nov 10, 2020

@rustbot modify labels: +T-compiler

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 10, 2020
@KodrAus
Copy link
Contributor

KodrAus commented Nov 10, 2020

r? @scottmcm

@rust-highfive rust-highfive assigned scottmcm and unassigned KodrAus Nov 10, 2020
@tesuji
Copy link
Contributor

tesuji commented Nov 10, 2020

Cc @joshtriplett because of the change to how libc linked.

@scottmcm
Copy link
Member

scottmcm commented Nov 11, 2020

Sorry, this is code I've never seen before and I have no experience in how these things are built, so I don't feel qualified to review this. I'll head to zulip and see if triage knows a better reviewer...

@jyn514 jyn514 added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 11, 2020
@jyn514
Copy link
Member

jyn514 commented Nov 11, 2020

@bjorn3 can you explain why the rustc-link-lib lines aren't necessary?

@Mark-Simulacrum
Copy link
Member

r? @Mark-Simulacrum

I'm probably a goodish reviewer here, or at least will be able to forward if needed.

@jyn514
Copy link
Member

jyn514 commented Nov 11, 2020

@bjorn3 can you explain why the rustc-link-lib lines aren't necessary?

Oh I missed that you used explicit link(name) below, ignore me.

@Mark-Simulacrum
Copy link
Member

This seems correct to me. That said, I would not anticipate us removing the build script support from rustbuild in the near future, it seems unlikely for that to be all that beneficial and the work to remove build scripts in comparison seems quite high. That said, the changes here seem reasonable and like they improve the quality of the code in question a little.

@bors r+ rollup=never for easier bisection

@bors
Copy link
Contributor

bors commented Nov 14, 2020

📌 Commit 89db5d03c6adcaad3e6564280c2db65d1397a294 has been approved by Mark-Simulacrum

@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 Nov 14, 2020
@bjorn3
Copy link
Member Author

bjorn3 commented Nov 14, 2020

That said, I would not anticipate us removing the build script support from rustbuild in the near future, it seems unlikely for that to be all that beneficial and the work to remove build scripts in comparison seems quite high.

It is nice to have, but I don't think it is worth the effort either. At least for now. Maybe miniz_oxide will remove the build script in a future release and maybe cargo will get native support for the remaining usages of the build script of libstd, but then the compiler_builtins use case will still be hard to do without a build script.

@bors
Copy link
Contributor

bors commented Nov 15, 2020

⌛ Testing commit 89db5d03c6adcaad3e6564280c2db65d1397a294 with merge cab1b85235027c97ae850618bba022dc518c922a...

@bors
Copy link
Contributor

bors commented Nov 15, 2020

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 15, 2020
@Mark-Simulacrum
Copy link
Member

r=me with commits squashed

Remove all rustc-link-lib from the std build script. Also remove use of
feature = "restricted-std" where not necessary.
@bjorn3
Copy link
Member Author

bjorn3 commented Nov 15, 2020

splat

@bors r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Nov 15, 2020

📌 Commit 6f3872a has been approved by Mark-Simulacrum

@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 Nov 15, 2020
@bors
Copy link
Contributor

bors commented Nov 16, 2020

⌛ Testing commit 6f3872a with merge 45b36722bf32c27018e6c2c3e91d9a40cdc17732...

@rust-log-analyzer
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[command]/usr/bin/git submodule foreach --recursive git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :
[command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
##[endgroup]
##[group]Fetching the repository
[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=2 origin +45b36722bf32c27018e6c2c3e91d9a40cdc17732:refs/remotes/origin/auto

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Nov 16, 2020

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 16, 2020
@bjorn3
Copy link
Member Author

bjorn3 commented Nov 16, 2020

Spurious network error:

Err:1 http://azure.archive.ubuntu.com/ubuntu bionic/main amd64 python3-setuptools all 39.0.1-2
  Could not connect to azure.archive.ubuntu.com:80 (52.147.219.192), connection timed out
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/p/python-setuptools/python3-setuptools_39.0.1-2_all.deb  Could not connect to azure.archive.ubuntu.com:80 (52.147.219.192), connection timed out
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

@bors retry

@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 Nov 16, 2020
@bors
Copy link
Contributor

bors commented Nov 17, 2020

⌛ Testing commit 6f3872a with merge 54508a2...

@bors
Copy link
Contributor

bors commented Nov 17, 2020

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 54508a2 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 17, 2020
@bors bors merged commit 54508a2 into rust-lang:master Nov 17, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 17, 2020
@bjorn3 bjorn3 deleted the less_sysroot_build_scripts branch November 17, 2020 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.