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

Link a rustup toolchain automatically in x.py setup #89206

Closed
Sl1mb0 opened this issue Sep 23, 2021 · 11 comments
Closed

Link a rustup toolchain automatically in x.py setup #89206

Sl1mb0 opened this issue Sep 23, 2021 · 11 comments
Assignees
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@Sl1mb0
Copy link
Contributor

Sl1mb0 commented Sep 23, 2021

Issue tracker for linking a rustup toolchain automatically in x.py setup.

@Sl1mb0 Sl1mb0 changed the title Create ./x.py setup --build N --toolchain-link $NAME Create ./x.py setup --build $N --toolchain-link $NAME Sep 23, 2021
@Mark-Simulacrum
Copy link
Member

Can you say more about the motivation? Initially, I would say that it is pretty likely that we do not want to support this kind of "aggregation" in the x.py interface; it complicates the information and I'm not sure it improves the user interface.

@Sl1mb0
Copy link
Contributor Author

Sl1mb0 commented Sep 23, 2021

I agree that I don't think it improves the user interface much, but I think that the interface for this specific feature could be made better. My only argument for why I think this capability should be added is that it's natural to create a toolchain for the compiler immediately after having built it, so why not give ./x.py the capability to do so?

However, as I understand it you only need to run rustup once to create a toolchain for the build, and subsequent builds will always be used by the toolchain. So I can see why this is kind of pointless.

@Mark-Simulacrum
Copy link
Member

I think streamlining the toolchain creation process is worthwhile to invest into; e.g., we could give a suggestion at the end of the first x.py build in a new build directory (with a stamp file just saying 'did that') to run rustup link .... with the appropriate path.

@Sl1mb0
Copy link
Contributor Author

Sl1mb0 commented Sep 23, 2021

I like that idea. I'll wait for more feedback before I start looking into it though.

@jyn514
Copy link
Member

jyn514 commented Sep 23, 2021

Hmm, I would rather set up the toolchain automatically when running x.py setup, and give a warning if a toolchain named stage1 already exists, along with the command to set it up yourself.

If we gave a warning the first time you run x.py build, then a) people who aren't developing locally get confused (e.g. distros building from source) because they don't actually care about this, and b) x.py has no way of knowing whether you actually add the toolchain or not; I can definitely see people missing it the first time and then never getting the warning again just because x.py is using a stamp file.

@jyn514 jyn514 added A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Sep 23, 2021
@Mark-Simulacrum
Copy link
Member

Yeah, x.py setup seems better. I think rustup won't let you do it without the sysroot somewhat existing, though:

$ rustup toolchain link foo foo
error: not a directory: 'foo/lib'

But I think we have enough in setup that we can probably create the directory temporarily...

@jyn514 jyn514 changed the title Create ./x.py setup --build $N --toolchain-link $NAME Link a rustup toolchain automatically in x.py setup Sep 23, 2021
@jyn514
Copy link
Member

jyn514 commented Sep 23, 2021

Mentoring instructions: just after

println!("`x.py` will now use the configuration at {}", include_path.display());
, call rustup toolchain link stage1 build/TARGET/stage1, where TARGET is builder.config.build. If that errors, give a warning and suggest that the user do it themselves.

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Sep 23, 2021
@Sl1mb0
Copy link
Contributor Author

Sl1mb0 commented Sep 23, 2021

where TARGET is builder.config.build

Could you clarify this? I assumed you were referring to build::Builder, but there is no config field there..

@jyn514
Copy link
Member

jyn514 commented Sep 23, 2021

@Sl1mb0 it derefs to Build, which should have a Config field.

@workingjubilee
Copy link
Member

It should be noted that the toolchain linking/unlinking rustup does is not always just a symlink, it is sometimes a hardlink, depending on the OS. This can cause issues because it makes the linkage inherently touchier. I am not saying this should not be done, merely that if someone finds this issue later after it causes trouble, then it should become special-cased by OS.

@nerandell
Copy link

@rustbot claim

@nerandell nerandell removed their assignment Sep 25, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 28, 2021
x.py: run `rustup toolchain link` in setup

Addresses rust-lang#89206

r? `@jyn514`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 28, 2021
x.py: run `rustup toolchain link` in setup

Addresses rust-lang#89206

r? ``@jyn514``
@Sl1mb0 Sl1mb0 closed this as completed Oct 2, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 6, 2022
…etup, r=Mark-Simulacrum

Fix linking stage1 toolchain in `./x.py setup`

Closes [92319](rust-lang#92319)

Fix linking stage1 toolchain in `./x.py setup`. I guess this can be considered a follow up to rust-lang#89212 by `@Sl1mb0.`

We create 2 directories and 1 file that are required by rustup to [link a custom toolchain from path](https://github.com/rust-lang/rustup/blob/5225e87a5d974ab5f1626bcb2a7b43f76ab883f0/src/toolchain.rs#L479-L497).

cc `@jyn514` and `@Mark-Simulacrum` as they were active in rust-lang#89206
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 7, 2022
…etup, r=Mark-Simulacrum

Fix linking stage1 toolchain in `./x.py setup`

Closes [92319](rust-lang#92319)

Fix linking stage1 toolchain in `./x.py setup`. I guess this can be considered a follow up to rust-lang#89212 by ``@Sl1mb0.``

We create 2 directories and 1 file that are required by rustup to [link a custom toolchain from path](https://github.com/rust-lang/rustup/blob/5225e87a5d974ab5f1626bcb2a7b43f76ab883f0/src/toolchain.rs#L479-L497).

cc ``@jyn514`` and ``@Mark-Simulacrum`` as they were active in rust-lang#89206
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 7, 2022
…etup, r=Mark-Simulacrum

Fix linking stage1 toolchain in `./x.py setup`

Closes [92319](rust-lang#92319)

Fix linking stage1 toolchain in `./x.py setup`. I guess this can be considered a follow up to rust-lang#89212 by ```@Sl1mb0.```

We create 2 directories and 1 file that are required by rustup to [link a custom toolchain from path](https://github.com/rust-lang/rustup/blob/5225e87a5d974ab5f1626bcb2a7b43f76ab883f0/src/toolchain.rs#L479-L497).

cc ```@jyn514``` and ```@Mark-Simulacrum``` as they were active in rust-lang#89206
m-ou-se added a commit to m-ou-se/rust that referenced this issue Feb 7, 2022
…etup, r=Mark-Simulacrum

Fix linking stage1 toolchain in `./x.py setup`

Closes [92319](rust-lang#92319)

Fix linking stage1 toolchain in `./x.py setup`. I guess this can be considered a follow up to rust-lang#89212 by ````@Sl1mb0.````

We create 2 directories and 1 file that are required by rustup to [link a custom toolchain from path](https://github.com/rust-lang/rustup/blob/5225e87a5d974ab5f1626bcb2a7b43f76ab883f0/src/toolchain.rs#L479-L497).

cc ````@jyn514```` and ````@Mark-Simulacrum```` as they were active in rust-lang#89206
m-ou-se added a commit to m-ou-se/rust that referenced this issue Feb 7, 2022
…etup, r=Mark-Simulacrum

Fix linking stage1 toolchain in `./x.py setup`

Closes [92319](rust-lang#92319)

Fix linking stage1 toolchain in `./x.py setup`. I guess this can be considered a follow up to rust-lang#89212 by `````@Sl1mb0.`````

We create 2 directories and 1 file that are required by rustup to [link a custom toolchain from path](https://github.com/rust-lang/rustup/blob/5225e87a5d974ab5f1626bcb2a7b43f76ab883f0/src/toolchain.rs#L479-L497).

cc `````@jyn514````` and `````@Mark-Simulacrum````` as they were active in rust-lang#89206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

5 participants