Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
After following the instructions in https://github.com/aws/aws-sdk-cpp/wiki/Building-the-SDK-from-source-on-EC2 cmake outputs the following errors:
CMake Error at /usr/local/lib/aws-c-common/cmake/aws-c-common-config.cmake:10 (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.5/Modules/CMakeFindDependencyMacro.cmake:65 (find_package)
/usr/local/lib/aws-c-event-stream/cmake/aws-c-event-stream-config.cmake:2 (find_dependency)
/usr/share/cmake-3.5/Modules/CMakeFindDependencyMacro.cmake:65 (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:3 (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.5/Modules/CMakeFindDependencyMacro.cmake:65 (find_package)
/usr/local/lib/aws-c-event-stream/cmake/aws-c-event-stream-config.cmake:3 (find_dependency)
/usr/share/cmake-3.5/Modules/CMakeFindDependencyMacro.cmake:65 (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:3 (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.5/Modules/CMakeFindDependencyMacro.cmake:65 (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:3 (find_package)
SDK version number
1.8.3
Platform/OS/Hardware/Device
16.043.5.1To Reproduce (observed behavior)
Follow the wiki page instructions.
Expected behavior
Successful cmake run.
I've once run into the same error and the problem is that cmake is trying to find the c dependencies as a static installation. Watch the path cmake is trying: /usr/local/lib/aws-c-common/cmake/static/aws-c-common-targets.cmake. Try checking this path, it should contain a folder name shared instead of static. I'm unable to reproduce this solution to certify to you, but I think this is a start point.
@rvernica ,
As @andre237 said, it seems like cmake is looking for static libraries of the dependencies and those may have been build/installed as shared libs.
I'd recommend building the dependencies independently, and you can follow these instructions on how to do that, and see if that works for you... that should at least help us know what's going on.
Yes, the path contains a shared directory:
> ls lib/aws-c-common/cmake/
aws-c-common-config.cmake shared
Just to clarify, the error output listed above is not from trying to build the SDK, but from trying to build the s3sample/program.cpp example listed on the wiki page linked above.
I was able to make the example work using a CMakeList.txt file similar to the one from here.
@rvernica yea,
When building the s3sample/program.cpp, when you run cmake you still need to specify:
cmake <code_path> -DBUILD_SHARED_LIBS=ON DCMAKE_PREFIX_PATH=<install-path>
This is a known point of confusion on the sdk that basically happens because we try to build the dependencies on the background as part of this project, but in reality they are independent projects and so they have their own build defaults which happen to be static, so when you tell cmake to go look for them, cmake considers either their default or what you tell it is looking for.
Anyways, try that and let me know if it works for you.
I agree, it looks like adding -DBUILD_SHARED_LIBS=ON on the command line or option(BUILD_SHARED_LIBS "Build shared libraries" ON) in CMakeLists.txt solves the issue.
great!
I'll be marking this issue to closing, let me know if you have any other questions though.
Sounds good. Maybe a small change to the wiki page is warranted to include the shared lib flag and save others from the same frustration.
Most helpful comment
I agree, it looks like adding
-DBUILD_SHARED_LIBS=ONon the command line oroption(BUILD_SHARED_LIBS "Build shared libraries" ON)inCMakeLists.txtsolves the issue.