在 Cloud9 上安装 AWS C++ SDK 时出现问题
Problems installing AWS C++ SDK on Cloud9
我正在尝试在我的 Cloud9 环境中安装 AWS C++ SDK(m4.large)。我遵循了 this 教程中的步骤。
我的步骤:
sudo yum -y install libcurl-devel openssl-devel libuuid-devel cmake3
wget https://github.com/aws/aws-sdk-cpp/archive/master.zip
unzip master.zip
rm master.zip
mkdir sdk_build && cd sdk_build
cmake3 ../aws-sdk-cpp-master -DBUILD_ONLY="dynamodb" //I changed s3 to dynamodb
make && cd ..
文件中dynamodb-demo.cpp
:
#include <aws/core/Aws.h>
int main(){ return 0;}
在CMakeLists.txt
中:
cmake_minimum_required(VERSION 2.8)
project(dynamodb-demo)
find_package(aws-sdk-cpp)
add_definitions(-DUSE_IMPORT_EXPORT)
add_executable(dynamodb-demo dynamodb-demo.cpp)
target_link_libraries(dynamodb-demo aws-cpp-sdk-dynamodb)
问题似乎出在这里这个命令没有抛出错误但是有一个警告:
cmake3 -Daws-sdk-cpp_DIR=sdk_build .
输出:
CMake Warning at /usr/share/cmake3/Modules/CMakeFindDependencyMacro.cmake:65 (find_package):
By not providing "Findaws-c-event-stream.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"aws-c-event-stream", but CMake did not find one.
Could not find a package configuration file provided by
"aws-c-event-stream" with any of the following names:
aws-c-event-streamConfig.cmake
aws-c-event-stream-config.cmake
Add the installation prefix of "aws-c-event-stream" to CMAKE_PREFIX_PATH or
set "aws-c-event-stream_DIR" to a directory containing one of the above
files. If "aws-c-event-stream" provides a separate development package or
SDK, be sure it has been installed.
Call Stack (most recent call first):
sdk_build/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
sdk_build/aws-sdk-cpp-config.cmake:1 (include)
CMakeLists.txt:14 (find_package)
CMake Warning at CMakeLists.txt:14 (find_package):
Found package configuration file:
/home/ec2-user/environment/sdk_build/aws-sdk-cpp-config.cmake
but it set aws-sdk-cpp_FOUND to FALSE so package "aws-sdk-cpp" is
considered to be NOT FOUND. Reason given by package:
aws-sdk-cpp could not be found because dependency aws-c-event-stream could
not be found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ec2-user/environment
因此 make
命令抛出 fatal error: aws/core/Aws.h: No such file or directory
,我明白了,所以我想错误应该在上面的命令中。
我还没有配置我的 AWS 凭证,但我认为这不会引发那种错误。这个问题好像和cmake有关。
一些研究表明,aws-c-event-stream-config.cmake
应该位于 /home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-event-stream/cmake
处。
也许解决方案很简单,但我对cmake
只有基本了解。
和Tsyvarev's帮助项目配置:
cmake3 -DCMAKE_PREFIX_PATH=/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-checksums/cmake\;/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-common/cmake\;/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-event-stream/cmake\;/home/ec2-user/environment/sdk_build .
我也需要改变的事情:
构建 AWS 核心(不确定是否需要):
cmake3 ../aws-sdk-cpp-master -DBUILD_ONLY="core;dynamodb"
将此添加到您的 CMakeLists.txt
:
target_link_libraries(dynamodb-demo aws-cpp-sdk-core)
并将标准设置为 C++ 11:
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
我正在尝试在我的 Cloud9 环境中安装 AWS C++ SDK(m4.large)。我遵循了 this 教程中的步骤。
我的步骤:
sudo yum -y install libcurl-devel openssl-devel libuuid-devel cmake3
wget https://github.com/aws/aws-sdk-cpp/archive/master.zip
unzip master.zip
rm master.zip
mkdir sdk_build && cd sdk_build
cmake3 ../aws-sdk-cpp-master -DBUILD_ONLY="dynamodb" //I changed s3 to dynamodb
make && cd ..
文件中dynamodb-demo.cpp
:
#include <aws/core/Aws.h>
int main(){ return 0;}
在CMakeLists.txt
中:
cmake_minimum_required(VERSION 2.8)
project(dynamodb-demo)
find_package(aws-sdk-cpp)
add_definitions(-DUSE_IMPORT_EXPORT)
add_executable(dynamodb-demo dynamodb-demo.cpp)
target_link_libraries(dynamodb-demo aws-cpp-sdk-dynamodb)
问题似乎出在这里这个命令没有抛出错误但是有一个警告:
cmake3 -Daws-sdk-cpp_DIR=sdk_build .
输出:
CMake Warning at /usr/share/cmake3/Modules/CMakeFindDependencyMacro.cmake:65 (find_package):
By not providing "Findaws-c-event-stream.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"aws-c-event-stream", but CMake did not find one.
Could not find a package configuration file provided by
"aws-c-event-stream" with any of the following names:
aws-c-event-streamConfig.cmake
aws-c-event-stream-config.cmake
Add the installation prefix of "aws-c-event-stream" to CMAKE_PREFIX_PATH or
set "aws-c-event-stream_DIR" to a directory containing one of the above
files. If "aws-c-event-stream" provides a separate development package or
SDK, be sure it has been installed.
Call Stack (most recent call first):
sdk_build/aws-cpp-sdk-core/aws-cpp-sdk-core-config.cmake:2 (find_dependency)
sdk_build/aws-sdk-cpp-config.cmake:1 (include)
CMakeLists.txt:14 (find_package)
CMake Warning at CMakeLists.txt:14 (find_package):
Found package configuration file:
/home/ec2-user/environment/sdk_build/aws-sdk-cpp-config.cmake
but it set aws-sdk-cpp_FOUND to FALSE so package "aws-sdk-cpp" is
considered to be NOT FOUND. Reason given by package:
aws-sdk-cpp could not be found because dependency aws-c-event-stream could
not be found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ec2-user/environment
因此 make
命令抛出 fatal error: aws/core/Aws.h: No such file or directory
,我明白了,所以我想错误应该在上面的命令中。
我还没有配置我的 AWS 凭证,但我认为这不会引发那种错误。这个问题好像和cmake有关。
一些研究表明,aws-c-event-stream-config.cmake
应该位于 /home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-event-stream/cmake
处。
也许解决方案很简单,但我对cmake
只有基本了解。
和Tsyvarev's帮助项目配置:
cmake3 -DCMAKE_PREFIX_PATH=/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-checksums/cmake\;/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-common/cmake\;/home/ec2-user/environment/sdk_build/.deps/install/lib64/aws-c-event-stream/cmake\;/home/ec2-user/environment/sdk_build .
我也需要改变的事情:
构建 AWS 核心(不确定是否需要):
cmake3 ../aws-sdk-cpp-master -DBUILD_ONLY="core;dynamodb"
将此添加到您的 CMakeLists.txt
:
target_link_libraries(dynamodb-demo aws-cpp-sdk-core)
并将标准设置为 C++ 11:
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)