-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Compiler build depends on libstdc++-static #103606
Comments
Seems useful :) Happy to take a PR. |
It's a bit unfortunate default for local development but you can change it with Line 92 in 77e7b74
(Also remove .example from the name).
|
Changing the default also seems fine; maybe not the global default, but the named profiles in src/bootstrap/defaults at least. |
OK, folks, I need a decision on that. This is the default build configuration, which beginners will not look inside until later. It would seem odd to me to have the basic So our choices seem to be to add the static C++ library to the dependencies (and let them decide not to use it later, if so inclined), or to ensure The first option is strictly a one-line text change, which I can submit a pull request for. Changing the build's defaults would need to either wait for me to dive significantly deeper into this codebase, or be done by someone else. As a raw newbie in Rust, I don't think I should be the one to make that decision -- it's stylistic as much as coding, and I don't yet have any sense of the community's preferences or have a strong opinion either way. |
I don't know the history of this option. @jonhoo @mati865 why would you ever want to turn it on, given that it requires you to have an extra dependency turned on? @kubycsolutions I think adding a note to the readme that you need the dependency is a good change in the meantime. |
It's useful for dist builds because with that option disabled your binaries will depend on compatible libstdc++. Which might be hard to supply when building rustc for other system. |
Ok, cool. Sounds like we should disable it by default and reenable it in dist builders. @kubycsolutions are you interested in making that change? :) Mentoring instructions: |
Soitenly. Expect pull request a bit later. I need to check your practice -- fork first, or for something this simple just submit PR? (Most projects prefer fork. I tend to cheat on my own.) (Woke up, got my eyes uncrossed, edited, noted that |
Might be overkill for this, but for future reference: What's the recommended smoketest before a PR against rust? (I know the compiler built, and I believe the change is correct, but... (Belt, suspenders, helium balloons, drones.) |
@kubycsolutions |
Good 'nuff. |
OK. Fixed the missing quote. The pull request is still failing its sanity checks. Current failure seems to be It isn't entirely clear which file it's complaining about, but I'm guessing that it wanted |
Question: When building under WSL/fedora, I'm seeing the warning
Expected, or did I miss a setup step? (I'd assume the latter, but the C++ code throws a lot of warnings while compiling so I'm not expecting a 100% warning-free build.) |
Currently getting following from PR checking. Looking into why.
Trying |
Another beginner question: Tidy called me out on formatting (tab character). Thought I'd just run
(Tidy also changed a heck of a lot more files than I expected, so I've reverted that. But trying to run rustfmt over just bootstrap/config.rs gave me the same warnings, and I'd sorta like to understand what's going on for future reference.) ((I noticed in passing rustfmt doesn't fully grok the
style; it wants to move .bar() up onto the let line. Not a big deal, just a minor feature to be added someday.)) |
Autocheck is still failing, and I'm not sure what's causing the issue:
|
@kubycsolutions I suggest posting questions about how to implement your change on https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap, Github is annoying to use for conversations. That said, I think your problem here is that the key is named |
Rollup of 9 pull requests Successful merges: - rust-lang#100633 (Consider `#[must_use]` annotation on `async fn` as also affecting the `Future::Output`) - rust-lang#103445 (`#[test]`: Point at return type if `Termination` bound is unsatisfied) - rust-lang#103924 (Fix broken link in description of error code E0706) - rust-lang#104146 (Retry binding TCP Socket in remote-test-server) - rust-lang#104169 (Migrate `:target` rules to use CSS variables) - rust-lang#104202 (Fix ICE rust-lang#103748) - rust-lang#104216 (Don't ICE on operator trait methods with generic methods) - rust-lang#104217 (Display help message when fluent arg was referenced incorrectly) - rust-lang#104245 (Reduce default configuration's dependency upon static libstdcpp library (rust-lang#103606)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Sorry it took me forever to get back to this! Note that the default was specifically changed to statically build against libstdc++ in #94832. The reasoning was that it was already the default whenever |
Hmm, we could gate the default on |
Most people working with |
The intent was that it would leave LLVM unchanged, affecting only default build of the full compiler. I must admit I haven't done before-and-after comparison of the LLVM to validate that.
…--
/_ Joe Kesselman (he/him/his)
-/ _) My Alexa skill for New Music/New Sounds fans:
/ https://www.amazon.com/dp/B09WJ3H657/
() Plaintext Ribbon Campaign
/\ Stamp out HTML mail!
________________________________
From: Ralf Jung ***@***.***>
Sent: Sunday, November 13, 2022 1:16:31 PM
To: rust-lang/rust ***@***.***>
Cc: Joseph Kesselman ***@***.***>; Mention ***@***.***>
Subject: Re: [rust-lang/rust] Compiler build depends on libstdc++-static (Issue #103606)
Most people working with x.py and developing rustc won't build their own LLVM, x.py will download the one from CI for them. Did this here also change the way that that LLVM is built?
—
Reply to this email directly, view it on GitHub<#103606 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOKT7A5MY44Y47LCOWDZVWTWIEV77ANCNFSM6AAAAAARPQE7HU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This started as a suggestion to just add static-libstdcpp to the list of dependencies in the README, rather than having the user go thru discovering its absence only by building.
We could still discard my change set and go back to that, if it's the better answer I won't be offended.
…--
/_ Joe Kesselman (he/him/his)
-/ _) My Alexa skill for New Music/New Sounds fans:
/ https://www.amazon.com/dp/B09WJ3H657/
() Plaintext Ribbon Campaign
/\ Stamp out HTML mail!
________________________________
From: Jon Gjengset ***@***.***>
Sent: Sunday, November 13, 2022 1:02:20 PM
To: rust-lang/rust ***@***.***>
Cc: Joseph Kesselman ***@***.***>; Mention ***@***.***>
Subject: Re: [rust-lang/rust] Compiler build depends on libstdc++-static (Issue #103606)
Sorry it took me forever to get back to this!
Note that the default was specifically changed to statically build against libstdc++ in #94832<#94832>. The reasoning was that it was already the default whenever llvm-tools was included, which seems fairly common, and so we didn't want to suddenly change the default (though aiui, the PR here does). The second part of the reasoning was that the upstream Rust build is statically linked, so that's probably what folks expect, and not statically linking stdc++ makes it decently likely that users of the build (if you ever send it to another host) will run into problems if their stdc++ is older than what was on the build host, which is a pain to work around.
—
Reply to this email directly, view it on GitHub<#103606 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOKT7A5JZ3JPM65XCCXZYV3WIEUKZANCNFSM6AAAAAARPQE7HU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
To be clear I am happy about this change for entirely unrelated reasons.^^ It brings me one step closer to having rustc_llvm not be rebuilt when I share a build cache between the flatpak sandbox and the host. I just don't understand why this helps, since I figured either way I must link to the downloaded LLVM. There is logic in bootstrap that prevents one from (un)setting LLVM options, but it seems when the default changes that still somehow has an effect... |
Looks like a wrong link? I think you mean #104245. But bootstrap then still invokes rustc_llvm as if |
That might be a bug ... Can you open an issue? |
What is a bug? I don't know what I am talking about here.^^ I just observe that, if I understood the code correctly, |
We build dist with static libstdc++. |
Yes. And then local bootstrap uses the default value for It seems to work though... |
@RalfJung the defaults are mostly ignored when using downloaded LLVM. Instead we use the settings LLVM was built with. The logic is non-trivial but unless you've run into issues I'm inclined to think there's no bug here. |
I can say for sure that changing the default of llvm_static_stdcpp changed some build details when using LLVM from CI - it no longer tells the rustc_llvm build script about where the static stdcpp is located. I am happy about the change, but the default is definitely not getting ignored.
|
Location
https://github.com/rust-lang/rust#building-on-a-unix-like-system
Summary
The README lists a number of packages which have to be present for
./x.py build
to succeed.In my Win10/WSL/fedoraremix environment, I found I had to also install
libstdc++-static
before compilation could start. It now seems to be running without errors (though with some warnings in the.cpp
files on-Warray-bounds, -Wnonnull
, and-Wcast-function-type
).This may be a quirk of how this fedora was adapted to run under WSL. But adding that dependency to the instructions seems worth considering; it shouldn't hurt anything and might help some.
The text was updated successfully, but these errors were encountered: