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

Cleanup: Get rid of -static-libstdc++ argument unused warning #89983

Closed

Conversation

hkratz
Copy link
Contributor

@hkratz hkratz commented Oct 17, 2021

Building llvm with llvm.static-libstdcpp enabled leads to lots of warnings like this as this is linker-only option:

warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument]

Just setting it for linking shared libraries and executables gets rid of the warning.

@rustbot label +A-rustbuild +C-cleanup +T-infra

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Oct 17, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 17, 2021
@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 17, 2021

📌 Commit ebd674e 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 Oct 17, 2021
@Mark-Simulacrum
Copy link
Member

@bors rollup=iffy (may timeout due to LLVM rebuilds as we invalidate caches)

@bors
Copy link
Contributor

bors commented Oct 18, 2021

⌛ Testing commit ebd674e with merge d5315046e57455765cf4502a15fd3bd25ef3e9b8...

@bors
Copy link
Contributor

bors commented Oct 18, 2021

💥 Test timed out

@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 Oct 18, 2021
@matthiaskrgr
Copy link
Member

@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 Oct 18, 2021
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Oct 20, 2021

⌛ Testing commit ebd674e with merge 5e22860c3d3dcc1195b0a38ee482d3e150e5d78f...

@bors
Copy link
Contributor

bors commented Oct 20, 2021

💥 Test timed out

@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 Oct 20, 2021
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@hkratz
Copy link
Contributor Author

hkratz commented Oct 20, 2021

This time the LLVM build for aarch64-apple-darwin was even slower.

First failed build:

cargo:root=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/llvm
 	finished in 4418.216 seconds

Second failed build:

cargo:root=/Users/runner/work/rust/rust/build/aarch64-apple-darwin/llvm
	finished in 5061.989 seconds

Usually that build takes about 500 seconds (fully cached). No idea what is going on with sccache here.

@Mark-Simulacrum
Copy link
Member

Hm, it doesn't seem like we dump sccache stats on failed builds unfortunately.

Maybe sccache fails to cache or something like that without this argument? That would be unexpected, IMO, but who knows...?

@hkratz
Copy link
Contributor Author

hkratz commented Oct 20, 2021

Maybe sccache fails to cache or something like that without this argument? That would be unexpected, IMO, but who knows...?

The cache worked fine for x86_64-apple-darwin and the other builds though. The funny thing is that -static-libstdc++ is not supported at all by Apple clang anyway and ignored:

$ clang++ -static-libstdc++ main.cc
clang: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument]
$ otool -L a.out
a.out:
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 905.6.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)

So it should actually be completely disabled for Apple.

But not really worth it to investigate further right now just for the log cosmetics.

@rustbot label -S-waiting-on-review +S-waiting-on-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 Oct 20, 2021
@hkratz hkratz marked this pull request as draft October 20, 2021 16:40
@matthiaskrgr
Copy link
Member

@bors r- (bors having hiccup and trying to retest failed prs)

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2022
…ark-Simulacrum

bootstrap: tidy up flag handling for llvm build

This tidies up the logic in `src/bootstrap/native.rs` such that:

 - `CMAKE_*_LINKER_FLAGS` is not overridden if we add to it twice.
 - `CMAKE_*_FLAGS` also include the standard `*FLAGS` environment
   variables, which CMake respects when we _don't_ set `CMAKE_*_FLAGS`.
 - `llvm.ldflags` from `config.toml` appends to the ldflags Rust's
   bootstrap logic adds, rather than replacing them.

It also takes a second stab at rust-lang#89983 by moving `-static-libstdc++` to just be passed as a linker flag, since that's what it is.

Fixes rust-lang#93880. Fixes rust-lang#70468. Closes rust-lang#89983.
@bors bors closed this in 3669274 Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants