===== UPDATE 05.04.2021 =====
It seems very difficult to create a build system for VS2015. Finding ways to download the build tools seems sketchy at best. My thoughts at to maybe recommend VS2019 build tools and try to avoid having anyone go down the path of VS2015 build tools.
VS2015 Build System
In either path (navigate or direct link) once the installer was downloaded, I had trouble getting the installer to work. Apparently this is not something unique or new (reference here).
- Scroll down to the "Other Tools, Frameworks, and Redistributables" accordion tab
- Click the Download button next to Microsoft Build Tools 2015 Update 3
- Direct Link:
In the end, it was easier to download the VS2019 community edition and then skip the default install, install individual components and get the necessary VS2015 things.
- Install VS2019 community edition
- Run installer
- Go to individual components tab
- Type "build" in the search components to filter
- Scroll down to MSVC v140 - VS 2015 C++ build tools (v 14.00)
- Type "cmake" in the search components to filter
- Select C++ CMake tools for Windows
NOTE: If VS2019 build tools are installed, to get the Python SDK build to work, set an ENV variable (example build error below).
- CMAKE_GENERATOR=Visual Studio 14 2015
Once installed, trying to install couchbase (either python3 -m pip install couchbase, or from source python3 setup.py build_ext --inplace) would fail due to an incorrecty location of Microsoft.Cpp.Default.props. This seemed to be related to the MSBuild using VCTargetsPath, which isn't set so the location defaults to C:\Microsoft.Cpp.Default.props (see error below). Fix was to set an ENV variable for VCTargetsPath to match where MSBuild has Microsoft.Cpp.Defaults.props
- VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140
There might also be an issue with missing the Windows SDK 8.1. The build will specifically mention the 8.1 SDK is missing. So, download and install the SDK. Also, if after install the build still fails, it might be necessary to set and ENV variable (see below)
After everything was installed, I was able to build the client (python3 setup.py build_ext --inplace, also python3 -m pip install -e <path to client code> works), but installing via pip (python3 -m pip install couchbase) failed due to filenames being too long (error below). This leads me to believe that without a wheel, you cannot install the client via pip. Clear answer is get wheels for all the supported python versions and the client. But that will take a bit more time.
NOTE: conda environments look to have the same problem.
I tried updating the registry to set LongPathsEnabled, also tried to edit the group policy to enable long paths option. Neither helped. This looks to be a problem with MSBuild that is apparently fix in v16.0. Adds credence to recommending a VS2019 build system.
- Issue: https://stackoverflow.com/questions/139964/msbuild-directory-structure-limit-workarounds
- Fix: https://github.com/dotnet/msbuild/issues/53#issuecomment-459062618
VS2019 Build System
Install VS2019 community edition, as long as Desktop development with C++ tools are included (one of the main page selections) the default install should work.
It is possible that the C:\Microsoft.Cpp.Default.props not found error will exist. This can be fixed by setting and ENV variable. Also, I think running w/in the Developer Command Prompt for VS 2019
- VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160