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

Add windows-build-tools to Readme #970

Closed
wants to merge 2 commits into from

Conversation

felixrieseberg
Copy link
Member

Hi from Microsoft's open source team! We're trying to make things better - and one of the things we wanted to make easier is the installation of requirements to run node-gyp. Instead of installing stuff manually, Windows users can now simply run npm i -g windows-build-tools, which will install the C++ build tools and Python (conflict-free) and then configure npm appropriately.

This PR simply adds a reference to those tools to the readme.

@@ -42,15 +42,17 @@ You will also need to install:
* You also need to install the `Command Line Tools` via Xcode. You can find this under the menu `Xcode -> Preferences -> Downloads`
* This step will install `gcc` and the related toolchain containing `make`
* On Windows:
* Visual C++ Build Environment:
* Option 1: Install [Visual C++ Build Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools) using the **Default Install** option.
* Option 1: Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install -g windows-build-tools` from an elevated PowerShell (run as Administrator).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you don't use PowerShell when doing this? What happens when you don't use elevated privileges?

Copy link
Member Author

@felixrieseberg felixrieseberg Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Not using cmd: We'll spawn a little ps1 (invisible) in the background.
  • Not admin: You'll get a pretty error message (telling you to try again as admin) and an exit code 1. Installation is not attempted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you recommend Command Prompt instead? I suspect it will be simpler for many users. Or both: "Command Prompt or PowerShell".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, PowerShell is rather easier to use for most users due to various unix-like aliases, nicer output and various UX issues (like multiline copy) solved. As a developer working on Windows, I'd say this is what most developers on Windows use nowadays.

Copy link

@xzyfer xzyfer Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PowerShell is rather easier ... I'd say this is what most developers on Windows use nowadays

Anecdotally in my time running the relatively popular native extension, node-sass, I don't believe this to be the case. At least not among developers using node primarily for their asset pipeline.

@rvagg
Copy link
Member

rvagg commented Jun 29, 2016

Amazing, this'll be fantastic if it's as simple as it looks. @felixrieseberg can you point to where you're modifying npm config to make this work? I'd like to understand how you're doing this that makes it conflict-free and yet makes npm/node-gyp safely aware of it.

@nodejs/platform-windows could you please take a look at this and give some opinions?

@felixrieseberg
Copy link
Member Author

Of course (and thanks for the 🌷!). The project is here and is really just a little wrapper around the required MSIs, running them headless with the appropriate parameters. IT Admins have been installing things on Windows headless for years, so a coin dropped when somebody asked me why the heck she/he can't install the build tools directly from npm.

In detail, the C++ build tools come with no-conflict (they simply won't install if the appropriate packages have already been installed by either the tools themselves or other applications). Python's 2.7 MSI does not modify PATH, so we can simply install it into a custom dotfolder inside the user's home folder without hurting anyone (wasting files, maybe, but certainly not breaking things). We then tell npm where we put Python.

If any of the smart people in @nodejs/platform-windows have feedback/input/things to yell at me, I'd ❤️ to hear it.

@rvagg
Copy link
Member

rvagg commented Jun 29, 2016

Ah nice, so the C++ tools go into a standard location, that's the bit I was imagining being hard to do a custom location, Python being in a custom location makes sense although I wonder if it'll make a difference not having python in the PATH. I'd love to hear feedback on having this tried out on a suite of popular addons to confirm that it works well. If it does then this will be absolutely huge and you'll be a hero @felixrieseberg! This is one of the biggest pain points experienced by Node users.

@joaocgreis
Copy link
Member

@felixrieseberg thanks for submitting this! I tried this and it did not go too well, opened an issue in your repo: felixrieseberg/windows-build-tools#5 . But I'm sure we can make it work!

@joaocgreis
Copy link
Member

cc @mousetraps

@eljefedelrodeodeljefe
Copy link

Left two tickets also. Most importantly: can you state what BuildTools_Full.exe does or contains? Are the contents under some kind of license? Ref: felixrieseberg/windows-build-tools#7

Also I would be very happy if compatibility and user friendliness are No. 1 priority for this. Since we don't have quite the history doing so on NT, I fear the promise issue, v4 compat and introducing PowerShell aren't helping.

I personally would love to see more OSS behind what BuildTools_Full.exe ships.

Otherwise I love where that heads. Thx.

@felixrieseberg
Copy link
Member Author

@eljefedelrodeodeljefe: Super fair point - the build tools package comes straight from the Visual Studio C++ Compiler team. You can read more about it here. They are free. Included, in detail:

Visual C++ Compilers (targeting x86, X64 and ARM)
Visual C++ headers & libraries (CRT & STL)
Visual C++ build scripts (targeting Windows desktop)
Microsoft Build Tools 2015 (MSBuild)
Windows SDK 8.1 (optional, on by default)
Windows SDK 10 (optional, off by default)
ATL and MFC (optional, off by default)
C++ Build tools specific command prompts

(I hear your point though, this should be in the readme - and will be added).

@eljefedelrodeodeljefe
Copy link

@felixrieseberg awesome and thanks for addressing this. And thanks for the for link. I assume W10 SDK is included then in what we download, right (it's marked as optional above)? Then it's everything I hoped and everything we'd need for NT build environment.

Shout outs to the compiler team. I dig into their doc a little then.

@felixrieseberg
Copy link
Member Author

In 99% of cases, you probably want the 8.1 Kit, so that's what's in there right now. To be clear, 8.1 binaries run well on Windows 10, you just need 10 for 10-specific features - and I'm not aware of any npm modules that do. The other way around, the 10 SDK does require 10, which is why a slightly older SDK probably hits more people. Again, thanks for helping out and being interested.

@eljefedelrodeodeljefe
Copy link

I was doing some related work, basically guessing on include paths. There was at least one W10, but tbh, I can be wrong or it's currently obsolete. Just asking b/c I had to specifically install it on my VS2015 setup afterwards. Please also note, I write on OS X but am enthusiastic for the NT stuff.

I was attempting building a toolchain without python here, but in any case lack of compiler or unknown locations of it would have been a major obstacle. I am integrating your work and probably can give more feedback afterwards. Really excited now.

@felixrieseberg
Copy link
Member Author

Thanks to those of you trying it out - thanks to your help, we managed to figure out that smaller machines would run into memory/cpu limits, mostly because I went a bit overboard with tailing the logfiles. The whole thing is now a lot less resource hungy and installs fine on a little Windows machine with less than 1 GB in total memory.

@rvagg
Copy link
Member

rvagg commented Jul 14, 2016

@joaocgreis @orangemocha can you have a look at the latest incarnation of this and see if it's something we might be prepared to promote?

@joaocgreis
Copy link
Member

@felixrieseberg Have you had a chance to look at felixrieseberg/windows-build-tools#8 (comment) ?

@rvagg We certainly want to promote this, but it is currently downloading the wrong package and has to be fixed upstream first.

@felixrieseberg
Copy link
Member Author

@joaocgreis That was a fixed a few days ago, I just forgot to update folks - sorry for forgetting to comment on that one.

@joaocgreis
Copy link
Member

Tested, LGTM.

Will land tomorrow if there are no objections.

joaocgreis pushed a commit that referenced this pull request Jul 25, 2016
Added Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) to the readme.

PR-URL: #970
Reviewed-By: João Reis <[email protected]>
@joaocgreis
Copy link
Member

Landed in f6eab1f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants