How to build AWS C++ SDK on Windows

How to build AWS Cpp SDK on Windows with Visual Studio 2017 toolchain.

1. Download SDK

The AWS SDK for C++ is hosted on GitHub.

In Git Bash or a Unix-like shell in Windows (we like CMDer), run:

git clone https://github.com/aws/aws-sdk-cpp.git

cd aws-sdk-cpp
mkdir _build
cd _build

2. Configure AWS C++ SDK build parameters

Note: these instructions assume you already have CMake installed on your system.

Building the whole AWS SDK takes a long time. If you already know what AWS APIs you’ll be using, you can configure the SDK to only build the packages relevant to you.

In this example, we only build a subset of the AWS Cpp SDK modules, using the BUILD_ONLY flag:

  • S3
  • DynamoDB
  • KMS

We also configure the SDK to use static C Runtime (CRT) linking, and not build shared libraries / DLLs, ideal for building self-contained executables that you can distribute without any dependencies.

cmake .. -G "Visual Studio 15 Win64" -DSIMPLE_INSTALL=OFF -DBUILD_SHARED_LIBS=OFF \
-DFORCE_SHARED_CRT=OFF -DMINIMIZE_SIZE=ON \
-DCPP_STANDARD=17 -DBUILD_ONLY="dynamodb;s3;kms"

cmake -DCMAKE_BUILD_TYPE=Release --build .

To install to a custom path, add the following to the first cmake call above

 -DCMAKE_INSTALL_PREFIX=<deps-install-dir> -DCMAKE_PREFIX_PATH=<deps-install-dir>

The default install path for the SDK on Windows is ‘C:\Program Files\aws-cpp-sdk-all’.

3. Build the AWS C++ SDK

If you want to install the SDK to its default location (C:\Program Files\aws-cpp-sdk-all), you need to run the following commands on a Visual Studio 2017 x64 Native Tools command prompt as administrator.

msbuild INSTALL.vcxproj /p:Configuration=Release
msbuild INSTALL.vcxproj /p:Configuration=Debug

4. Done!

AWS C++ SDK and its depedencies are now installed at ‘C:\Program Files\aws-cpp-sdk-all’ or the custom path that you specified.

5. Troubleshooting

Issue: you specified the list of clients to build with -DBUILD_ONLY, but the build fails with the following message:

-- Considering
CMake Error at cmake/sdks.cmake:25 (get_dependencies_for_sdk):
  get_dependencies_for_sdk Function invoked with incorrect arguments for
  function named: get_dependencies_for_sdk
Call Stack (most recent call first):
  CMakeLists.txt:209 (include)

Solution: ensure there are no trailing semicolons at the end of -DBUILD_ONLY (e.g. “s3;kms” and not “s3;kms;”) . We find this behavior silly however, and have submitted a pull request to make the AWS SDK build script more robust.

Where did your disk space go?

Find out with Drive Declutter for Windows



Version 1.1 (3 MB download)