Aws-sdk-cpp: BUILD_SHARED_LIB flag does not propogate to 3rd party AWS Libraries

Created on 22 Nov 2019  路  5Comments  路  Source: aws/aws-sdk-cpp

What platform/OS are you using?

Ubunut 18.04

Which version of the SDK?

master

What compiler are you using? what version?

g++ 7.4.0

What are your CMake arguments?

None
(CMAKE_PREFIX_PATH Includes path to build directory)

Can you provide a TRACE level log? (sanitize any sensitive information)

When compiling a sample application, I get the following stack trace:

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:10 (find_package)


CMake Error at /usr/local/lib/aws-checksums/cmake/aws-c-event-stream-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:10 (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:10 (find_package)

I "fixed" this by editing each of the cmake files (aws-c-event-stream-config.cmake, aws-c-event-stream-config.cmake, and aws-c-common-config.cmake) and removing the if statements so that only the shared path is used.

closing-soon guidance

Most helpful comment

Same issue here, as jywang01 said, need to do cmake . -DBUILD_SHARED_LIBS=ON" on your own app folder.

All 5 comments

BUILD_SHARED_LIBS is by default undefined. You can simply specify this at the CMake command line
-DBUILD_SHARED_LIBS=ON
See report: https://github.com/awslabs/aws-c-common/pull/506

Interesting, per the AWS docs, BUILD_SHARED_LIBS defaults to ON.
If this is the case, then there should be a default set in CMake IMO. Thoughts?

It defaults to on in SDK's cmake scripts, but when building your sample application, you provide your own cmake scripts.

even with -DBUILD_SHARED_LIBS=ON, it still got the same error. Oh, never mind, I see the problem there, you need to specify -DBUILD_SHARED_LIBS=ON when doing "cmake . -DBUILD_SHARED_LIBS=ON" on your own app folder.

Same issue here, as jywang01 said, need to do cmake . -DBUILD_SHARED_LIBS=ON" on your own app folder.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aramesh7 picture aramesh7  路  5Comments

lakehanne picture lakehanne  路  4Comments

efendizadeh picture efendizadeh  路  5Comments

KeithBlonquist picture KeithBlonquist  路  4Comments

jakelawcheukwun picture jakelawcheukwun  路  6Comments