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

Do not copy libstd dynamic library to sysroot #131188

Merged
merged 2 commits into from
Oct 5, 2024

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Oct 3, 2024

Since #122362, rustc links statically to libstd.[so|dll]. Which means that the libstd.[so|dll] file no longer has to be in the rustc sysroot. However, we are currently still shipping this file, in every new release of Rust, for no reason, it's just wasted bytes.

This PR removes the dynamic library file from the built sysroot.

However, it is not yet performed on Windows, because stage0 incremental tests start failing there (see description of the issue here).

This is an extended version of #128986.
CC @Zoxc

@rustbot
Copy link
Collaborator

rustbot commented Oct 3, 2024

r? @albertlarsan68

rustbot has assigned @albertlarsan68.
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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 3, 2024
@Kobzol Kobzol mentioned this pull request Oct 3, 2024
@@ -1,4 +1,5 @@
//@ run-pass
//@ no-prefer-dynamic We move the binary around, so do not depend dynamically on libstd
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this changed needed? Was it linking to the compiler's std copy before? If so, why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test was buggy. It compiled a Rust binary that dynamically linked to libstd.so. Then it moved the binary around, which should have broken it. However, the binary somehow linked to the compiler's std copy instead (!), so it worked by accident.

Copy link
Member

@lqd lqd Oct 3, 2024

Choose a reason for hiding this comment

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

Since UI tests are built with -Cprefer-dynamic did they all (modulo no-prefer-dynamic) dynamically link to the compiler's std?

Copy link
Contributor Author

@Kobzol Kobzol Oct 4, 2024

Choose a reason for hiding this comment

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

I don't think so, no other tests broke. It was probably just caused by the fact that this binary was moved around, lost its link to the target library and then somehow got dynamically linked to the compiler one instead.

EDIT: or, in theory, all tests could have linked to the compiler's std before, and now they link to target instead, that's a second explanation. But that would mean that all cross-compiled tests would be failing before, right?

@klensy
Copy link
Contributor

klensy commented Oct 3, 2024

Since #122362, rustc links statically to libstd.[so|dll]

Well, for CI one (x86_64-pc-windows-msvc) - yes, but my locally build copy for some reason links dynamically (messed up config.toml, probably?)

Ah, so, this is stage dependent.

@Kobzol Kobzol force-pushed the remove-libstd-so-from-sysroot branch from 57ead4a to f59c8ff Compare October 4, 2024 13:35
@onur-ozkan
Copy link
Member

You can r=me if you want.

@Kobzol
Copy link
Contributor Author

Kobzol commented Oct 5, 2024

As usually with these kinds of changes, it's hard to predict all the repercussions that this can have. Let's see if full CI passes, and if yes, if someone starts to complain.

@bors r=onur-ozkan rollup=never

@bors
Copy link
Contributor

bors commented Oct 5, 2024

📌 Commit f59c8ff has been approved by onur-ozkan

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 Oct 5, 2024
@bors
Copy link
Contributor

bors commented Oct 5, 2024

⌛ Testing commit f59c8ff with merge e561499...

@bors
Copy link
Contributor

bors commented Oct 5, 2024

☀️ Test successful - checks-actions
Approved by: onur-ozkan
Pushing e561499 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 5, 2024
@bors bors merged commit e561499 into rust-lang:master Oct 5, 2024
7 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 5, 2024
@Kobzol Kobzol deleted the remove-libstd-so-from-sysroot branch October 5, 2024 17:08
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e561499): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary 1.9%, secondary 0.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.9% [1.4%, 2.4%] 2
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) 1.9% [1.4%, 2.4%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 773.78s -> 773.813s (0.00%)
Artifact size: 342.21 MiB -> 329.46 MiB (-3.73%)

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants