rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
95.18k stars 12.27k forks source link

[feature] please provide support portable windows #116028

Open vkingnew opened 10 months ago

vkingnew commented 10 months ago

please provide the portable package to support windows 10 ,windows 11. In some conditions ,it's hard to download the package from public Internet;in some conditions,there is no permission to install the windows binary package,the portable package is desired. The portable windows package is convenient.

bjorn3 commented 10 months ago

What exactly are you asking for? A rust installer for windows which works offline? We already have that: https://forge.rust-lang.org/infra/other-installation-methods.html A bundle of a rust installer + C toolchain? The x86_64-pc-windows-gnu target bundles MinGW and for x86_64-pc-windows-msvc we legally can't distribute the MSVC toolchain. Or do you mean something for cross-compiling to Windows from say Linux? For that you can install the MinGW toolchain on your linux system and then use the x86_64-pc-windows-gnu target.

vkingnew commented 9 months ago

IN some cases,for example the windows system privileges not permit to install msi or exe file.I need a zip file,unzip it then use. Here is an example: https://www.voidtools.com/en-us/downloads/ --> portable zip .

bjorn3 commented 9 months ago

You should be able to extract the .msi file using 7zip. Using msiexec /a path/to/the.msi may also work, but I found conflicting answers^1 about if that needs admin privileges or not.

ehuss commented 8 months ago

Copying a similar request from https://github.com/rust-lang/rust-forge/issues/225 (though I'm not sure if that one is specifically about being portable, I think the effect is the same):


If you go here:

http://forge.rust-lang.org/other-installation-methods#standalone-installers

you see MSI and TAR.GZ installers for Windows. This is strange because typically programming language vendors will offer:

  1. MSI or EXE installer
  2. ZIP file with compiler or interpreter that can be extracted and run

the Rust TAR.GZ is similar to option 2, but if you extract rustc.exe wont actually run because even with the TAR.GZ it has to be extracted and installed before rustc.exe is usuable. This contrasts with other programming languages that offer both an executable installer and ZIP files that can be extracted and run. For example Go:

https://golang.org/dl

and Nim:

https://nim-lang.org/install_windows.html

Python:

https://python.org/downloads/release/python-373

and C#:

https://dotnet.microsoft.com/download/dotnet-core/2.2

PHP:

https://windows.php.net/download

Perl:

http://strawberryperl.com/releases.html

JamesTheAwesomeDude commented 5 months ago

You should be able to extract the .msi file using 7zip

@bjorn3 The innards of that thing don't seem very accessible, if you use 7-Zip. It's a bunch of weird metadata files.

Per the Stack Overflow answer you cited, it looks like this seems to work, though (with the caveat that there's no official way to install rustfmt — which is a dependency of some popular frameworks — without rustup):

REM this does not seem to need administrator privileges
REM nor does it seem to pollute the registry
REM YMMV ETC
msiexec /a "%USERPROFILE%\Downloads\rust-1.75.0-x86_64-pc-windows-msvc.msi" /qb TARGETDIR="%cd%"
ECHO To install rustfmt, follow the instructions at https://github.com/tauri-apps/tauri/issues/4124#issuecomment-1936414378

(Obviously, replace "%cd%" with a different folder, if you want to extract it somewhere else.)

SeidChr commented 1 month ago

Messing with programming stuff for some ages now, i am naturally cautious with running installers. Please give me a zip file as everyone else does. :) Why would i need an installer for adding a bloody path entry? What are you hiding huh? ;)

JamesTheAwesomeDude commented 3 weeks ago

@SeidChr I see you stuck the "Confused" emoji as a reply on my workaround. Did it not work for you?

If you don't like running an opaque binary "installation wizard" blob that does god-knows-what to your system, and you don't trust the unprivileged-msiexec workaround to eliminate the "god-knows-what" factor, you can always just run that command in a VM or something to "self-serve" a portable copy of Rust that can later be plopped as-is onto genuinely unmolested systems.

SeidChr commented 3 weeks ago

@JamesTheAwesomeDude It's exactly what i did. Just because i know how it's possible, doesn't mean that i prefer to do that.

The compiler is available as part of the build process. So just zipping it and provide an additional download is trivial.

It's a small feature, with great benefits of not having to start a sandbox, install it using an installer, copying the installed files off the sandbox.

ChrisDenton commented 2 weeks ago

The Other Installation Methods page now lists .tar.gz archives along side the .msi. This can be extracted using 7zip. Or with the latest versions of Windows you can just use File Explorer.

The trouble is, as ehuss says, it's a raw archive of component parts. To put it together you'd need some kind of code to read the manifest.in files and create the needed directory layout. Which is what installers like rustup and msi do for you.

JamesTheAwesomeDude commented 1 week ago

To put it together you'd need some kind of code to read the manifest.in files and create the needed directory layout.

FWIW, I just discarded the Manifest files and manually flattened the folder structure by 1 level (I'm sure something like GNU tar's --strip-components would achieve similar results), and it seems to have produced a functional ZIP-style installation.

The recent addition of those awkward precompiled archives is a big step in the right direction, for sure.

ChrisDenton commented 1 week ago

The recent addition of those awkward precompiled archives is a big step in the right direction, for sure.

Note that they were always available for use by installers. They just weren't advertised to users.

I just discarded the Manifest files and manually flattened the folder structure by 1 level

That may work at the moment but nothing guarantees that it'll continue to work.