-
Notifications
You must be signed in to change notification settings - Fork 903
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
Specifying an installation directory #618
Comments
Hi @AtheMathmo! Today This is not explicitly documented, but should be. Perhaps in the It probably also make sense to add installation options to the installer, both interactive and non-interactive. What do you think @Diggsey @alexcrichton ? |
Hm, changing the installation dir in the installer comes with some complexity because after installation the environment should be configured with custom values for |
Sounds good to me! |
Thanks for the reply. I managed to get this working locally with the following command
I had to use However this didn't work as expected. Though rustup is added to the path if I try to uninstall I see the following:
And if I try to use cargo:
I am using windows with MINGW64, which may be adding some complication. I'll try doing this on my ubuntu machine in a little while. Edit: Managed to get past the uninstall error by setting CARGO_HOME/RUSTUP_HOME again. I then faced a permissions issue so I had to brute force it. |
Similar issues on Ubuntu. I install with:
Calling Calling Trying to uninstall with
The The biggest issue here for me seems to be the toolchain problems. From what I understand there should always be a global toolchain set? I suppose for now I could just override the directory toolchain in the heroku build pack. Let me know if I'm misunderstanding anything. EDIT: Sorry for the information overload. I managed to fix the toolchain issue just by adding Looks like it is usable for what I need - albeit with a few quirks. |
Thanks for the further investigation @AtheMathmo. This does indeed look all kinds of buggy. I am not sure what's happening offhand but I will try to investigate ... sometime 😢 |
No problem. I'm happy to put a little more time in trying to figure this out. If you know the relevant areas of code I can dig around a little - though I'm not sure I'll be of too much use. |
Setting My personal use case for this is that Version: |
@ruuda I personally installed rustup.rs normally, and then set |
@retep998 great idea! Now that I check, it looks like Rustup put the toolchains in my configured |
@ruuda |
Unfortunately, it seems like Edit: my mistake - my rustup was old and had an old directory structure, upgrading fixed it |
…richton Give a hint of what to do if rustup is installed cc #618 (comment)
Choosing where to install something is pretty basic functionality.
So just print a message telling the user to set those variables ? I mean, the installer already sets the PATH for the user, which is extremely fishy since chances are this will be lost on re-loggin. We should just be printing a message here telling the user that for everything to work correctly these variables must be set. Ideally, in an easy to copy-paste way. That's pretty much what all installers do that install something that require setting the environment in any particular way. There is no reliably way for the installer to set these, so this is something that users just have to do or else nothing will work. |
What is the status on this? At work, I have a very small |
rustup-init still isn't offering a way to customize install location. Why is this difficult to fix? |
This comment has been minimized.
This comment has been minimized.
Moderator note Please don't pile on on issues pressuring people to fix them. Rust is a volunteer-run project and sometimes things just take time. If you want to help it might be possible to ask the maintainers to provide pointers for what code specifically needs fixing. Thanks! (Please do not reply to this comment, if you have questions email [email protected]) |
For those interested, you can amend the place that Documentation to this effect is in https://github.com/rust-lang/rustup.rs/#choosing-where-to-install As such, I'm going to close this issue. |
@kinnison Does the installer already tell users that this can be done, and how to do it, or does the installer ask the user if they want to install rustup in a non-default location, and let them specify a path ? An installer that does not do that gives a pretty bad impression, particularly if the user needs to install things first, then search for where the things got installed, then find out whether that installation path can be changed, then remove the installation, and then reinstall things again. IMO the installer should be at least telling users where it is going to install things, and whether that can be changed, and how to change it. Something like:
|
Currently we only report the I'm not sure quite what the best way to provide this is, but if you feel your example is sufficient then please open a fresh issue to request that directly. |
- Add rust env variables: CARGO_HOME, RUSTUP_HOME. More detail to rust-lang/rustup#618. - Add cargo install directory variable: CARGO_INSTALL_ROOT. More detail to https://doc.rust-lang.org/cargo/commands/cargo-install.html.
With your hints managed to get it working and successfully build projects like libredirectionio.
|
I just found the issue here. My use case is a bit different - I install everything into versioned Rust would reside at e. g.
That directory ( /home/Programs/ ) I also regularly back up, install onto other GoboLinux uses a simpler scheme, with only /Programs/. I was also using I suppose I could find all files rust installs and use a script to relocate all (The issue here is quite long; I think it would be best if somewhere there A configure option such as --prefix or --installation-prefix or something Hmm tried it. The target ended up being:
There are the bin/ lib/ etc... subdirectories. I suppose the toolchains/ directory is hardcoded. If this is the case |
No, |
I read every comment on this issue and did some web searches. I have concluded that RUSTUP_HOME is not documented except here. I'm probably wrong, but I don't currently see how. So, I recommend documenting that! |
|
For Windows users
|
@pcdinh I don't think this is correct. I just tried it, but after installing it this way, any new process that opens still uses the wrong You need to set these variables globally and permanently like this, then restart your PC. Then, install rustup the usual way. Then it works properly. |
Environment variables should be avoided at any cost. It's always leads to a mess. It's enough it have an installation path in just PATH variable and a configuration file with everything else in there. And it's not something difficult to implement. Why going worst way? |
Because these variables are also read by build scripts and such. It's not just for rustup. |
Not sure if necro or new ticket would be more appropriate, but perhaps the rustup-init installer should make mention of the environment variables. I had to google this, and the only documentation I found was this ticket/a reddit thread. |
I think a new issue would be helpful for us to keep track of this! |
@Bauxitedev not sure it is helpful to you anymore, or if Windows 11 perhaps changed, but setting environment variables in Windows (10 at least) is enough - you have to use a program that uses the refreshed env vars. You do not need to restart your PC, just any programs that need to re-read the environment variables (actually the variables are already updated but the programs have read them already and stored them in some memory cache). Practically speaking this means on windows modifying system env vars, then opening from Explorer (which does the right thing and reads variables every time). If you tried e.g. from your browser it wouldn't have worked, because these programs don't re-read environment variables constantly (and for normal operation it doesn't make sense, like running an exe you just downloaded - take it up with the browser maker/Microsoft if you disagree). @djc Done. @regs01 I don't love environment variables but I don't agree that it would be easier without (and just with config files). Config paths/files lead to "config hell", environment variables represent an immutable snapshot of some system state, which is more dynamic and in general easier to work with. You lose some dynamic configuration ability, but really who wants that for installing rust, or building it etc? That's better from some program that's using files as a poor man's RPC/messaging protocol, not for general system state. |
For those poor souls who still can't do this on Windows. Here is a hijacked comment that managed to work for me on Reddit: Sure! Here’s the modified text with
Take note that the first script will only add variables to the current User. If you want to add variables to the system, use this command instead:
For some reason I also have to restart my PC after running the first script for it to work. TLDR: Here is the full code that work for me
restart PC
|
Opned in 2016, closed in 2019, and still generating discussion. Maybe there's more to be done here! |
A quick search through the issue tracker came up short - my apologies if this has been asked before.
I'm wondering if there is a way to specify an installation directory other than e.g.
$HOME/.cargo
.I'm faced with a situation right now where it would be useful. I'm using a custom buildpack to deploy a Rust app to Heroku. Heroku provides a Cache directory which persists between builds - but as I am unable to install to this directory I have to reinstall my toolchain and dependencies each time.
If this isn't currently possible and is deemed useful I'd be happy to take a crack at it.
The text was updated successfully, but these errors were encountered: