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

Please update gyp to add support for Visual Studio 2013 #339

Closed
JayBeavers opened this issue Oct 18, 2013 · 14 comments
Closed

Please update gyp to add support for Visual Studio 2013 #339

JayBeavers opened this issue Oct 18, 2013 · 14 comments

Comments

@JayBeavers
Copy link
Contributor

https://code.google.com/p/gyp/source/detail?spec=svn1763&r=1725

I've started down this path and found I could not simply swap in gyp r1725 as the calling convention seems to have changed. I started modifying configure.js and node-gyp.js and found myself spiralling inward.

I will attempt to patch by bringing in the updated gyp files that add VS 2013 support without bringing in all updates to gyp.

While reviewing the gyp changes, I also noticed that support for --msvs_version has been dropped from newer versions of gyp.

@JayBeavers
Copy link
Contributor Author

Repro Case:

Windows 7 x64 computer with Visual Studio Express 2013 for Windows Desktop
Unable to compile node addins such as node-serialport

@samuelg
Copy link

samuelg commented Oct 22, 2013

Repro Case:

Windows 8.1 x64 with Visual Studio Professional 2013. Unable to compile node-spatialite.

Warning: for VCCLCompilerTool/CompileAs, invalid literal for int() with base 10:
'CompileAsCpp'
Warning: for VCCLCompilerTool/CompileAs, invalid literal for int() with base 10:
'CompileAsCpp'
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".
To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visua
l Studio 2005 or 3) add the location of the component to the system path if it
is installed elsewhere. [...\node_modules\spatia
lite\build\binding.sln]

@samuelg
Copy link

samuelg commented Oct 22, 2013

Installing Microsoft Visual Studio C++ 2012 for Windows Desktop Express Edition fixes this. It would be nice to not have this dependency however.

@gluwer
Copy link

gluwer commented Oct 28, 2013

Hi,

I've managed to compile node-sqlserver on Windows 8.1. First I've tried Windows SDK for 8.1, but there was a problem with finding VCBuild.exec by msbuild.exe. Then I've added the VS 2013 Desktop Express. It fixed the issue with VCBuild.exe but then I received the below error:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found.

I've changed the MSVSversion.py file by adding almost the same configurations as for VS 2012 (in several places; as in https://code.google.com/p/gyp/source/browse/trunk/pylib/gyp/MSVSVersion.py?spec=svn1763&r=1725) and this allowed to make a build.

Anybody knows if those changes are all needed. If yes, I'll provide a patch (pull request), so it will work without moving the whole gyp (as I read above it is not currently easy to move it to node-gyp).

@JayBeavers
Copy link
Contributor Author

In R1776, gyp fixes the remaining issue in VS 2013 support. Should be good to go for an update a this point.

@JayBeavers
Copy link
Contributor Author

Works beautifully, thank you.

@koistya
Copy link

koistya commented Oct 14, 2014

Still have to explicitly specify --msvs-version=2013 in order to install any npm package with node-gyp dependency without errors. Is there a workaround for this issue?

Platform: Windows 8.1 x64, Visual Studio 2013, node 0.10.32, node-gyp 1.0.2

@gimelfarb
Copy link

Updated node-gyp to the latest version (1.0.2) by: npm install node-gyp -g

Note that you also have to update the node-gyp that is internally used by node

Now, node-gyp will support your Visual Studio 2013 - you can check in the <npm-cache>/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py, in _CreateVersion method.

However, the native modules still won't build, giving an error that some include files are missing (ones from Windows SDK, like say winsock2.h). That is because Visual Studio 2013 is bundled with 7.1A SDK as the default. But default Toolset setting is 'v120', which expects the 8.1 SDK (which needs to be installed additionally).

To build with just the stock VS 2013, you need to change what toolset is being selected. You can do that by modifying ~/.node-gyp/common.gypi file (idea taken from here), and changing the toolset to 'v120_xp' instead (which will use the bundled 7.1A SDK):

{
  ...
  'target_defaults': {
     ...
     'configurations': {
        ...
        'Release': {
          'conditions': [
            ['target_arch=="x64"', {
              'msvs_configuration_platform': 'x64',
              'msbuild_toolset': 'v120_xp'            <--- THIS LINE!
            }],
        }
     }
  }
}

Voila - now the native npm modules will compile with the stock Visual Studio 2013 install!

@eirslett
Copy link

@gimelfarb Thanks a lot! I followed your instructions and in finally worked! 👍

@ghost
Copy link

ghost commented May 12, 2015

What path does ~/.node-gyp correspond to on Windows?

@gimelfarb
Copy link

@voltagex C:\Users\<username>\.node-gyp or using variables %USERPROFILE%\.node-gyp

@kierenj
Copy link

kierenj commented May 22, 2015

For me, .node-gyp doesn't have common.gypi. A subfolder, 0.12.3, does - but that file doesn't contain the line with "msbuild_toolset".

This is after I removed and reinstalled, my node-gyp version is 1.0.3, installed globally...

I know this is closed, but it just doesn't seem resolved - I have VS 2013, installed the latest version, and it doesn't work.. is there anything else I can try?

I get simply:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(55,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [D:....\node_modules\nightmare\node_modules\phantom\node_modules\dnode\node_modules\weak\build\weakref.vcxproj]

@keithl8041
Copy link

@kierenj did you follow the instructions posted earlier detailing how to re-install node-gyp. Solved my issue, I was getting the same as you.

@kierenj
Copy link

kierenj commented Jun 11, 2015

In the end after posting here a colleague told me to try setting the environment variable GYP_MSVS_VERSION to 2013, which worked instantly. Yours may work too keith thanks, but I'd suggest others with the problem could try "setx GYP_MSVS_VERSION 2013 /M" from an admin command prompt / PowerShell too :)

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

No branches or pull requests

8 participants