Hey @Zoxc , do you mind if I ask you some newbie questions about trying to bootstrap
rustc in windows?
I'm trying to do msvc
currently when I run
C:\Python27\python.exe x.py build, ...
I get a bunch of errors
saying "SecurityProtocol: Cannot convert null to type System.Net.SecurityProtocolType" due to invalid enumeration values"
and then that seems like its showing me a pseudo-call stack saying that is arising due to a call to DownloadFile
where its trying to download the beta build for bootstrapping
I cannot easily cut-and-paste the text itself, so I've been trying to transcribe it. Maybe I should post a screen grab of the window ...)
Are you on the latest Wimdows 10? Might be a PowerShell version mismatch
Windows 7 i think
yeah Windows 7 Sevice Pack 1
You recommend using Windows 10 instead?
I'm not wedded to any particular Windows version; I just had thought from past experience than when using a VirtualBox or VMWare like setup, you're usually better off going with an older version of Windows due to the performance overhead of virtualization
Try installing a newer PowerShell or .NET version
okay, but don't worry about upgrading my Windows 7 yet? I'll see, thanks!
Windows 7 should work fine, but I haven't tried it
hmm. there's this table with four different links depending on whether one wants PS (PowerShell) 3.0, 4.0, 5.0, or 5.1
which one do you have? I guessI could jump right to 5.1
(technically I guess its the version of the Window Management Framework (WMF)
thanks @Zoxc ! Now I've gotten past the download step. (And have hit an entirely new error, of course)
Did you fix it too? =P
at this point I'm downloading a Windows 10 VM
rather than keep trying to dissect every thing that pops up
Which error did you get? You should get a VM with copy and paste =P
I couldn't exactly tell what the error was. the message was pretty malformed
it was complaining that the command I was trying to run was not compatible with my version of windows
but it wrote "%1" rather than the command name
in the diagnostic
which I assume is some sort of interpolation bug
e.g. someone writing a message assuming .bat semantics, maybe?
I will admit that my problem may stem from using VS 2019
I did see the note saying that bootstrapping only works in certain (older) versions of Visual Studio
Seems like something is trying to run x64-64 binaries on x86-32 Windows
but the path here (https://github.com/rust-lang/rust#msvc) is not present on my (admittedly, free aka no-frills) Visual Studio install
hmm maybe it is indeed a 32-bit version, let me see
oh yeah this is absolutely 32-bit
so running vcvars64.bat is certainly not going to work then
You'll want https://github.com/Zoxc/rust/tree/vs2019 for VS 2019 support =P
is there a free version of VS that doesn't require using a branch off of master?
VS 2017 Community
Got to wait for @Alex Crichton to wake up for VS 2019 support on master
let me see if I can grab that...
I can't find an installer for VS 2017 Community. Microsoft seems to be pushing 2019 hard. :sad:
I tried that. even though it has a separate section for 2017, ... the Installer app it then gives you does a search for "Available" versions
and only shows 2019 for me. :sad:
going to "older downlolads" takes me to a "My Benefits" page under my.visualstudio.com that says "Sorry, we couldn't find any downloads for you."
/me should probably set a timer to limit how much more time he invests in this today
weird, I just saw a glimpse of 2017 under a different run of the installer.
okay so let me see if I can get that working
(oh wow, moving my VirtualBox VM's window off of my laptop screen and onto the external monitor's screen seems to have made the UX way way way more responsive...)
is the laptop high-dpi and the monitor not? maybe it's doing some really inefficient scaling?
downgrading from VirtualBox 6.0 to VirtualBox 5.2 seems like it may be a workaround
yeah Windows 7 Sevice Pack 1
I have successfully built Rust on Windows 7
nothing special happened
That was a longish time ago tho
I am having a more productive experience with my attempt atop Windows 10
Are you producing more data for Microsoft?
but this may be in part because Microsoft's set of free 90-day VirtualBox VM's only has 32-bit x86 for Windows 7. If you want/need x86_64, then you need to grab their Windows 10 VM
my attempt atop Windows 10 is currently building LLVM. I never got that far with my 32-bit Windows 7 VM
VS 2019 now work on master =P
Have you tried VMware?
in the past I used VMware
and maybe I should indeed use it now, since I suspect its performance is superior to VirtualBox
but various points in Mozilla's and/or Microsoft's infrastructure were pushing me to VirtualBox here
okay so at this point I've gotten a used Windows laptop
and I've installed both VS Studio 2017 Express edition, and VS Studio 2019 Community edition
I'm trying to figure out how to do this without purchasing anything
(to best emulate what some of our contributors need to do)
and I still have not managed to bootstrap Rust
mostly because I keep hitting what I assume are environment setup issues
Which issues? =P
my "most successful" runs tend to end with a link step problem
with a mismatch between x86 and x64
I'm doing another run right now, in order to transcribe the actual message
but my main question, for anyone who like me is trying to bootstrap atop windows using free Visual Studio downloads, is: What command prompt are you starting with?
my current run is using "x64 Native Tools Command Prompt for VS 2019"
I use plain powershell with python, cmake and git in PATH
I assume after running powershell, you need to invoke some other script to set up environment variables?
cmake, the cc crate and rustc will detect and use VS tools on their own
something analogous to vcvarsall.bat?
okay let me try powershell then
I'll use a msys2 shell if I need to run
run-make tests, as those need bash
just to be clear ...
the detection that the cmake, cc, rustc crates do ... you're saying that works only in powershell?
or it supposedly works in any terminal?
because ... if its any terminal ... then I would imagine I'm going to run into the same essential problem.
It works in any terminal
vcvarsall.bat might do something that overrides them
Are you on x64 now?
Are you using Visual Studio as your compiler? Or are you using ... what's it called ...
... whatever the way to get gcc and/or clang atop windows is ...?
I use msvc not mingw
did you do any customization of your environment that you can remember, in terms of what environment variables are set by default in your shell?
or are you using whatever the vanilla install of MSVC?
(and which MSVC is it? Are you on 2019 Community?)
(sorry for all the questions; I'm trying to gather as much info as I can up front so I can replicate a supposedly known-to-work environment)
clang-cl is msvc-like just for the record
I haven't done any setup for environment variables specific to Rust
I have VS 2017 and VS 2019 now, not sure which is used, but it worked when only VS 2019 was installed
I've been meaning to look more at Powershell anyway, especially after wycats' tweets raving about it
It's terrible. I just use it because it's VS Code's default, and I just run x.py in it =P
so you run as a subshell of a VS Code editor instance?
(that may be an important detail; its possible VS Code sets up envionment variables. I've just been trying to run in vanilla terminals, either cmd.exe, or the various bat scripts added to the Start Menu by Visual Studio install(s)
I use the VS Code terminal yes. That should not be important
A build from a clean slate (no build folder) with cmd.exe or powershell should not fail. File a bug if it's not from missing tools
are you saying that the current readme is wrong, here: https://github.com/rust-lang/rust/blob/master/README.md#msvc
where it says you may need to call the appropriate vcvars file before running the bootstrap?
Visual Studio 2013 is a bit of a clue =P
or are you just saying that VS 2019 is one of the Visual Studio versions that should (now) work out of the box
yeah well there is that "(or later)" next to that. :)
Probably dates the instructions to 2012
it'd be nice if we actually listed the versions that we know work
or maybe just the ones that we use for the CI testing
Our MSVC CI testing is a bit strange, it runs inside msys2 :/
I do not recommend that
hmm. and the CI builds might be inheriting environment state from the outer msys2, right?
Not might. They are
yeah that's unfortunate
I can understand having to fire off a build as some sort of subshell of msys2
just as an artifact of travis
but it would be good to find some way to isolate the inner subshell's environment state
(i am now wondering if my earlier environmental link issues are in fact because i kept running vcvarsall.bat or friends while trying to use VS 2019, based on earlier evidence that doing so was necessary for VS 2017)
I still haven't seen a successful bootstrap, but my most recent problems may well originate from my attempts to run
x.py outside of the root of the git checkout of rust.git
Giving up for today; filed "cl.exe handling of llvm\include broken for VS 2019?" #60507
Looks like something doesn't handle spaces correctly
So probably don't put the repo in a path with spaces
does anything work correctly with paths in spaces?
I keep hearing about this in various situations
(the sad answer is probably "malware, if that")
Plenty of things works correctly with spaces in path. Unix build systems and shell scripts always fail horribly though
They're pretty much perfectly designed to induce bugs
there are ways to make it work, but, yeah, using spaces to separate things was a mistake
you have to do silly things like
What do people do here, put their git checkout into C:\rust.git\ ?
C:\Users\eddy\Projects doesn't have any spaces in it :P
but, yeah, especially if you have two partitions, I wouldn't be surprised by
I store all my data on a separate partition from
I also don't have a username with a space =P
I got my machine with the account already set up with a space in my user name :(
and I decided it would not be worth the effort to attempt to revise thaet
AFAICT one can not easily rename themselves in Windows.
maybe you can make a directory hard link?
are we really not going to support this use case?
so you run stuff from
i guess this maybe worthy of a meta-policy discussion at a higher level.
at the very least, something to mention at the compiler team meeting. Maybe directory hard links are indeed an appropriate work around
but ... what about a developer who does not have Admin rights to their workstation?
I agree with fixing spaces in paths, but this is assuming we can do anything about it
I think anyone can create a directory under C: btw, but I could be wrong
I've done it before, at Adobe, i think by striving to switch to relative paths
but maybe that is not always an option
(e.g. when the relative/absolute path is embedded in the final product)
I agree that we should fix this to support spaces in paths. However, it seems like there should be another way to create a folder without any spaces in the path.
At least on my pc, I'm not prompted for elevated privileges to create a folder at
(This also is probably going to prompt me to file a bug with Mozilla IT on how they set up Windows Laptops; they really should have asked me for a user name)
I am prompted if I try to create a new folder under
C:\Users. So at least on Win 10, creating a folder at the root of the drive might be a workaround?
I remember being surprised I can just do this in XP/Win7
so this should work in every version, assuming we're not confused about it
Creating a folder at the root is also "nice" because it helps you avoid path length limitations
MAX_PATH = 260 characters unless you use "long paths" which are the
\\?\ style paths the win32 api supports)
yeah I think the compiler uses those long paths a lot
It should be using
\\?\ style paths at the appropriate places just like it should handle paths with spaces in them. ¯\_(ツ)_/¯
I remember being surprised I can just do this in XP/Win7
You cannot "just" create a directory under
C: without being an administrative account under W10
(in general W10 is now sane-by-default as far as things you can do to system-like directories go)
@pnkfelix I usually build rustc in a shell that is specifically launched by finding a "x64 shell" somewhere in the start menu
if I cannot find it there, I go and dig around
Program Files for it.
that's the Visual C++ Tools thing, right?
Yeah, something like that.