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

Windows 8.1 SDK + Platform Toolset v140 obscure requirements for building on a fresh Windows install #439

Closed
raphaabreu opened this issue Dec 6, 2021 · 7 comments · Fixed by #440

Comments

@raphaabreu
Copy link

While trying to install this package on Windows 11 I had several dificulties, the biggest of all was finding out that I needed to install this specific version of the toolset, required by one of the solutions. This toolset is not installed by default using any of the methods mentioned in the readme.

It would be good if the readme could be updated to point to the Visual Studio 2017 build tools:

https://visualstudio.microsoft.com/vs/older-downloads/

Also, to explicitly point out that you need to go on "Individual Components" and select "Windows 8.1 SDK" and "VC++ 2015.3 v14.00 (V140)"

image
image

Here are the logs I was only able to extract once I modified "build-c-client.ps1" to be verbose:

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Installing Aerospike C Client dependency
  Installing Aerospike C client source package
  Downloading https://artifacts.aerospike.com/aerospike-client-c/5.2.1/aerospike-client-c-src-5.2.1.zip to aerospike-client-c-src-5.2.1.zip
  Installing Aerospike C client dependencies
  Downloading https://www.nuget.org/api/v2/package/aerospike-client-c-dependencies/1.0.1 to aerospike-client-c-dependencies.1.0.1.zip
  Building VS project C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c-src-5.2.1\vs\aerospike\aerospike.vcxproj using build params "/p:Configuration="Release nodejs" /p:Platform=x64 /p:NodejsPath=C:\Users\Raphael\AppData\Local\node-gyp\Cache\16.13.1\x64 /p:PackagesPath=C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build /nr:Fa
  lse /m:4"
  **********************************************************************
  ** Visual Studio 2019 Developer Command Prompt v16.11.7
  ** Copyright (c) 2021 Microsoft Corporation
  **********************************************************************
  Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
  Copyright (C) Microsoft Corporation. All rights reserved.

  Build started 12/5/2021 10:58:09 PM.
       1>Project "C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c-src-5.2.1\vs\aerospike\aerospike.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\Raphael\Projects\
Blue\aerospike-client-nodejs\build\aerospike-client-c-src-5.2.1\vs\aerospike\aerospike.vcxproj] [C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c.vcxproj]
       1>Done Building Project "C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c-src-5.2.1\vs\aerospike\aerospike.vcxproj" (default targets) -- FAILED.
  
  Build FAILED.

         "C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c-src-5.2.1\vs\aerospike\aerospike.vcxproj" (default target) (1) ->
         (Desktop_PlatformPrepareForBuild target) ->
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\Raphael\Projects\ 
Blue\aerospike-client-nodejs\build\aerospike-client-c-src-5.2.1\vs\aerospike\aerospike.vcxproj] [C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c.vcxproj]

      0 Warning(s)
      1 Error(s)
"C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\binding.sln" (default target) (1) ->
"C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c.vcxproj" (default target) (2) ->
(CustomBuild target) ->
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(439,5): error MSB8020: The build tools for Visual Studio 2015 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install Visual Studio 2015 build tools.  Alternatively, you may upgrade to the current Visual Studi 
o tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c-src-5.2.1\vs\aerospike\aerospike.vcxproj] [C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c.vcxproj]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(439,5): error MSB8020: The build tools for Visual Studio 2015 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install Visual Studio 2015 build tools.  Alternatively, you may upgrade to the current Visual Studi 
o tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c-src-5.2.1\vs\aerospike\aerospike.vcxproj] [C:\Users\Raphael\Projects\Blue\aerospike-client-nodejs\build\aerospike-client-c.vcxproj]

To replicate: I started from a fresh Windows 11 install and went installing nodejs and the aerospike client. Everything coming from the current LTS versions.

@raphaabreu raphaabreu changed the title Platform Toolset = 'v140' Windows 8.1 SDK + Platform Toolset v140 obscure requirements for building on a fresh Windows install Dec 6, 2021
@raphaabreu
Copy link
Author

One other thing I forgot to mention: If your windows user folder ("c:\Users\Your Name") has spaces on it, the process also fails. It seems that spaces are not properly escaped inside one of the scripts, so you need to run this from an account that has no spaces on its home path -OR- change your current account home path, which might be a little bit nerve wracking.

@jhecking
Copy link
Contributor

jhecking commented Dec 7, 2021

Hi @raphaabreu, thanks for the detailed feedback! That helps a lot since I don't have access to a Windows build environment myself at the moment. I've verified that the specific Windows SDK + Toolset version is a dependency of the Aerospike C Client SDK. The developer is checking to see whether it's feasible to support more recent versions. In the meantime I will update the Windows README for the Node.js client as you suggested. I'll also check and see whether I can find the code where the file names need to be quoted to support spaces. Thanks again!

jhecking added a commit that referenced this issue Dec 7, 2021
@jhecking
Copy link
Contributor

jhecking commented Dec 7, 2021

@raphaabreu Can you take a look at the updated readme and let me know if this looks good to you?

https://github.com/aerospike/aerospike-client-nodejs/blob/439-windows-readme/README_WINDOWS.md

@raphaabreu
Copy link
Author

Thanks a lot @jhecking, that looks great! I wish I had saved the logs when I was having the issues with spaces in the windows user home path, but since that was a huge pain with other apps as well, I decided to do a fresh install and to make sure that I had no spaces in my home folder.

As to where the issue manifested, it surfaced on this line:

$process = Invoke-MsBuild -PassThru -Path $projectfile -Params $params -BuildLogDirectory $logdir -ShowBuildOutputInCurrentWindow:$verbose

It seemed to me whatever was calling the 'build-c-client.ps1' was not scaping or using " " to pass arguments, because the arguments seemed to be out of order when the msbuild was being invoked. Moving the project to a folder outside of my home did not help either because one of the paths was pointing to my npm folder insite my user/appdata.

jhecking added a commit that referenced this issue Dec 13, 2021
@jhecking
Copy link
Contributor

I have merged the changes to the Windows readme.

As for the issue with the spaces in the user folder, the build-c-client.ps1 script gets invoked by the following entry in node-gyp's binding.gyp config file:

              'action': [
                'powershell', 'scripts/build-c-client.ps1',
                    '-Configuration', "$(ConfigurationName)",
                    '-NodeLibFile', "<(node_root_dir)/<(target_arch)/node.lib"
              ]

It sounds like in your case node_root_dir is a directory name with spaces, and that's the root of the problem?

@raphaabreu
Copy link
Author

Yes, I believe so! When installing windows, if I go for a local account and put my first and last name, my user folder will have spaces on it, so everything under AppData, including user-level installs and temp folders would also have them and I do believe that this is the case. I can totally do a fresh windows install to try to use this lib just to ensure that the dev experience is as expected. Just let me know when the appropriate versions get published to npm.

@jhecking
Copy link
Contributor

I've filed a separate ticket for the issue with the spaces in the directory name: #441.

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

Successfully merging a pull request may close this issue.

2 participants