Linking issues with AWS SDK


I have limited knowledge in AWS SDK and Linux, but I have been reading into GCC and CMake syntax and trying to get myself to compile and run the sample on AWS Here is my second attempt at tackling this problem.

This is the environment I am running:

  • AWS Linux Cloud 9
  • gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
  • GNU Make 3.82
  • cmake3 version 3.6.1

I have used the following commands:

Building and run of AWS SDK Code:

My CMakeLists.txt that I use:

My modules/directories:

The Issue:

Many undefined references, here is a snippet:

  • Aws::Client::ClientConfiguration::ClientConfiguration()
  • Aws::InitAPI(Aws::SDKOptions const&)
  • Aws::S3::S3Client::S3Client(Aws::Client::ClientConfiguration const&, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy, bool, Aws::S3::US_EAST_1_REGIONAL_ENDPOINT_OPTION)
  • undefined reference to `Aws::S3::S3Client::~S3Client()
  • Some linking issues with Aws::Client::AWSClient::AWSClient(Aws::Client::AWSClient const&)

What I want to know:

  1. I know that -L helps to identify the shared library folder that I want to use, and -l the shared file I want to use. However, I have read that when building the AWS project above per instructions on the website, the targets and flags should auto-populate and I should not need to do any special linking to get this project working.
  2. It looks like the aws-cpp-sdk-core and aws-cpp-sdk-s3 are in my source folder aws-sdk-cpp. Should this be in my build folder sdk_build? Did I compile my project correctly?
  3. How do I build a successful out of source folder aws-sdk-cpp and should I build an in-source folder within aws-sdk-cpp?

Any assistance with my problem is appreciated.


Issues and corresponding solutions to them I have found during my build:

1. Undefined linker issues and unable to find dependencies from sdk_build.

Solution: Use AWSSDK in find_package of the CMakeLists.txt to guide us

2. Cmake build errors stating Cmake cannot find aws-sdk-cpp files such as aws-sdk-cpp-config.cmake, aws-c-event-stream-config.cmake.

Solution: AWS SDK looks for the binary and includes folders from the install path of sdk_build as per AWSSDKConfig.cmake. We shall add into ~/environment/CMakeLists.txt the following

3. Cmake build states that it is looking for static libraries when shared libs have been built during the install of sdk_build.

Solution: The CMakeLists.txt from aws-sdk-cpp builds into sdk_build as shared libs, looks like shared libs flag has not been turned on during linking, therefore it looks for static libs, we need to turn this on


Commands that I used to build C++ Sample:

Install required Tools

Building project on home/ec2-user/environment/

Tested output of executable s3-demo in terminal with

Files needed in /home/ec2-user/environment/

get your code in this link


Leave a Reply