mobileDev
mobileDev

Reputation: 1464

AWS SDK C++: cannot run S3 example

We are trying to build AWS SDK for C++ (only s3 module) on EC2 server, using setup and thread

It compiled fine, including s3 with tests

Next, I tried to compile the example

But, CMake is throwing the errors (as the error message shows, the file /usr/local/lib/aws-c-event-stream/cmake/static/aws-c-event-stream-targets.cmake does not exist). How do I fix it?

ubuntu@ip:~/awslog$ mkdir sdk_example_builds
ubuntu@ip:~/awslog$ cd sdk_example_builds/
ubuntu@ip:~/awslog/sdk_example_builds$ mkdir s3 && cd s3
ubuntu@ip:~/awslog/sdk_example_builds/s3$ sudo cmake /home/ubuntu/awslog/aws-doc-sdk-examples/cpp/example_code/s3


-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
CMake Error at /usr/local/lib/aws-c-common/cmake/aws-c-common-config.cmake:7 (include):
  include could not find load file:

    /usr/local/lib/aws-c-common/cmake/static/aws-c-common-targets.cmake
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
  /usr/local/lib/aws-c-event-stream/cmake/aws-c-event-stream-config.cmake:2 (find_dependency)
  /usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
  /usr/local/lib/cmake/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
  /usr/local/lib/cmake/AWSSDK/AWSSDKConfig.cmake:292 (find_package)
  CMakeLists.txt:15 (find_package)


CMake Error at /usr/local/lib/aws-checksums/cmake/aws-checksums-config.cmake:4 (include):
  include could not find load file:

    /usr/local/lib/aws-checksums/cmake/static/aws-checksums-targets.cmake
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
  /usr/local/lib/aws-c-event-stream/cmake/aws-c-event-stream-config.cmake:3 (find_dependency)
  /usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
  /usr/local/lib/cmake/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
  /usr/local/lib/cmake/AWSSDK/AWSSDKConfig.cmake:292 (find_package)
  CMakeLists.txt:15 (find_package)


CMake Error at /usr/local/lib/aws-c-event-stream/cmake/aws-c-event-stream-config.cmake:8 (include):
  include could not find load file:

    /usr/local/lib/aws-c-event-stream/cmake/static/aws-c-event-stream-targets.cmake
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package)
  /usr/local/lib/cmake/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
  /usr/local/lib/cmake/AWSSDK/AWSSDKConfig.cmake:292 (find_package)
  CMakeLists.txt:15 (find_package)


-- Found aws-cpp-sdk-core
-- Try finding aws-cpp-sdk-s3
-- Found aws-cpp-sdk-s3
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/awslog/sdk_example_builds/s3/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/awslog/sdk_example_builds/s3/CMakeFiles/CMakeError.log".

Upvotes: 1

Views: 1196

Answers (1)

TantrixRobotBoy
TantrixRobotBoy

Reputation: 629

From your log it is quite clear that the error is related to the cmake type of library.

In your case cmake is being called with a default to the static library; you can see that by checking at the path it is looking for:

/usr/local/lib/aws-c-common/cmake/static/aws-c-common-targets.cmake

In order to be able to compile your examples, just run CMake telling it to link over shared libraries as follows:

sudo cmake /home/ubuntu/awslog/aws-doc-sdk-examples/cpp/example_code/s3 -DBUILD_SHARED_LIBS=ON

And then

cd /home/ubuntu/awslog/aws-doc-sdk-examples/cpp/example_code/s3
sudo make

You're done!

P.S.: it is not clear why the AWS SDK library does not include the static cmake files (probably something in your configuration is missing). However this way you can used the shared library version of the SDK and you will be able to work the same way.

Upvotes: 1

Related Questions