Skip to content

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

Closed

Description

@JayBeavers

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.

Activity

  1. JayBeavers commented on Oct 19, 2013

    @JayBeavers
    ContributorAuthor

    Repro Case:

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

  2. samuelg commented on Oct 22, 2013

    @samuelg

    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]

  3. samuelg commented on Oct 22, 2013

    @samuelg

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

  4. gluwer commented on Oct 28, 2013

    @gluwer

    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).

  5. JayBeavers commented on Nov 5, 2013

    @JayBeavers
    ContributorAuthor

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

  6. JayBeavers commented on Nov 13, 2013

    @JayBeavers
    ContributorAuthor

    Works beautifully, thank you.

  7. koistya commented on Oct 14, 2014

    @koistya

    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

  8. gimelfarb commented on Oct 31, 2014

    @gimelfarb

    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!

  9. eirslett commented on Dec 16, 2014

    @eirslett

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

  10. gimelfarb commented on May 12, 2015

    @gimelfarb

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

  11. kierenj commented on May 22, 2015

    @kierenj

    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]

  12. keithl8041 commented on Jun 10, 2015

    @keithl8041

    @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.

  13. kierenj commented on Jun 11, 2015

    @kierenj

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions