-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using AWS C++ SDK with gcc-g++11 #2960
Comments
Can you make sure that you are following our guidelines for using this sdk. Specifically making all sdk calls within brackets #include <aws/core/Aws.h>
int main(int argc, char** argv)
{
Aws::SDKOptions options;
Aws::InitAPI(options);
{
// make your SDK calls here.
}
Aws::ShutdownAPI(options);
return 0;
} |
I was able to setup this docker container that matches the environment you're using: DockerfileFROM public.ecr.aws/amazonlinux/amazonlinux:2023-minimal
#install deps
RUN dnf install -y git cmake gcc-c++ libcurl-devel zlib-devel openssl-devel
# # Clone repo
RUN git clone --depth 1 --recurse-submodules https://github.com/aws/aws-sdk-cpp && \
cd aws-sdk-cpp && \
mkdir build && \
cd build && \
cmake -DAUTORUN_UNIT_TESTS=OFF -DBUILD_ONLY="secretsmanager" .. && \
cmake --build . && \
cmake --install .
# Copy Code Over \
RUN mkdir sdk-example
COPY CMakeLists.txt sdk-example/CMakeLists.txt
COPY main.cpp sdk-example/main.cpp
RUN cd sdk-example && \
mkdir build && \
cd build && \
cmake .. && \
cmake --build .
ENTRYPOINT [ "./sdk-example/build/sdk_example" ] main.cpp#include <iostream>
#include <aws/core/Aws.h>
#include <aws/secretsmanager/SecretsManagerClient.h>
using namespace std;
using namespace Aws;
int main() {
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;
Aws::InitAPI(options);
{
cout << "test setting up SecretsManagerClient" << endl;
auto config_ = std::make_unique<Aws::Client::ClientConfiguration>();
config_->region = "us-east-1";
auto sm_client_ = std::make_unique<Aws::SecretsManager::SecretsManagerClient>(*config_);
}
Aws::ShutdownAPI(options);
return 0;
} CMakeLists.txtcmake_minimum_required(VERSION 3.13)
project(sdk_example)
set(CMAKE_CXX_STANDARD 20)
find_package(AWSSDK REQUIRED COMPONENTS secretsmanager)
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(${PROJECT_NAME} ${AWSSDK_LINK_LIBRARIES}) To run this put all three files in one folder and run the following commands:
Please let me know if you still have any problems with using this sdk. |
Thanks for your advice, Joseph. |
I found the issue in our environment. Compilation issue resolved. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
Hello,
We are trying to port our solution to Amazon Linux 2023 on AMD and Graviton. As I understand, the only option for C++ development there is default toochain for gcc-g++11.
Following code compiles with devtoolset-10 (RHEL7) and gcc-toolset-13 (RHEL9). It also fails with gcc11 on RHEL9.
Since there is no toolsets option on Linux 2023, we need to make it working with gcc11 environment.
Do you have any idea?
Expected Behavior
Expecting the code compiles
Current Behavior
CPP file excerpt:
H file excerpt
Reproduction Steps
I think provided code is enough for reproduction
Possible Solution
No response
Additional Information/Context
No response
AWS CPP SDK version used
1.11
Compiler and Version used
g++ (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
Operating System and version
Amazon Linux 2023
The text was updated successfully, but these errors were encountered: