gpt4 book ai didi

c++ - 在 Ubuntu 上使用 cmake 安装 AWS SDK C++,安装第三方库时出现问题

转载 作者:行者123 更新时间:2023-12-04 08:13:30 28 4
gpt4 key购买 nike

我正在安装 aws-cpp-sdk在 Ubuntu 20.04 中按照以下安装说明进行操作:https://github.com/aws/aws-sdk-cpp
我按照有效的说明从源代码构建/安装了 SDK。安装位置:

  • /usr/local/lib
  • /usr/local/include/aws

  • 我构建/安装了 aws-c-common按照说明(虽然我没有使用 DCMAKE_INSTALL_PREFIX )。
    我尝试构建 aws-checksums但无法通过cmake。当我跑 cmake ..在代码目录中的构建目录中,我得到:
    -- The C compiler identification is GNU 9.3.0
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    /usr/local/lib/cmake/lib/cmake
    CMake Error at CMakeLists.txt:32 (include):
    include could not find load file:

    AwsCFlags

    CMake Error at CMakeLists.txt:33 (include):
    include could not find load file:

    AwsCheckHeaders

    CMake Error at CMakeLists.txt:34 (include):
    include could not find load file:

    AwsSharedLibSetup

    CMake Error at CMakeLists.txt:35 (include):
    include could not find load file:

    AwsSanitizers

    CMake Error at CMakeLists.txt:37 (include):
    include could not find load file:

    AwsFindPackage

    CMake Error at CMakeLists.txt:38 (include):
    include could not find load file:

    AwsFeatureTests

    CMake Error at CMakeLists.txt:116 (aws_set_common_properties):
    Unknown CMake command "aws_set_common_properties".

    -- Configuring incomplete, errors occurred!
    See also ...
    我试图将前缀指向 sdk 安装文件夹,但这并没有解决我的问题。这就是我陷入困境的地方。任何输入表示赞赏。谢谢你。

    最佳答案

    我创建了一个演示应用程序 s3-demo获取特定区域中的存储桶列表。此项目可在 github.com/unfor19/docker-aws-sdk-cpp 获得
    我也遇到了与您相同的问题(以及更多问题),但我终于能够编写一个构建 aws-sdk-cpp 和演示应用程序的 Dockerfile。
    这是我的 Dockerfile

    ARG AWS_SDK_CPP_VERSION="1.8.160"
    ARG AWS_SDK_CPP_BUILD_TYPE="Release"
    ARG APP_BUILD_TYPE="Release"

    ### -----------------------------------------------------
    ### Base image
    ### -----------------------------------------------------
    FROM ubuntu:20.04 as base

    # Fix tzdata hang
    ENV TZ=Etc/UTC
    RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

    RUN \
    apt-get update && \
    apt-get install -y \
    curl wget git zip unzip \
    cmake g++ gcc \
    libcurl4-openssl-dev libssl-dev libpulse-dev \
    uuid-dev zlib1g-dev

    RUN apt-get update && \
    apt-get install -y \
    make golang-1.13

    ENV PATH="$PATH:/usr/lib/go-1.13/bin"
    COPY scripts/ /usr/local/bin/
    WORKDIR /code/


    ### -----------------------------------------------------
    ### Build aws-sdk-cpp
    ### -----------------------------------------------------
    FROM base as build-aws-sdk-cpp
    ARG AWS_SDK_CPP_VERSION
    ARG AWS_SDK_CPP_BUILD_TYPE
    ENV AWS_SDK_CPP_VERSION="${AWS_SDK_CPP_VERSION}" \
    AWS_SDK_CPP_BUILD_TYPE="${AWS_SDK_CPP_BUILD_TYPE}"
    WORKDIR /code/
    RUN download.sh "https://github.com/aws/aws-sdk-cpp/archive/${AWS_SDK_CPP_VERSION}.zip"
    WORKDIR /sdk_build/
    RUN cmake /code/aws-sdk-cpp-${AWS_SDK_CPP_VERSION} -DBUILD_ONLY="s3" -DCMAKE_BUILD_TYPE="${AWS_SDK_CPP_BUILD_TYPE}"
    RUN make && \
    make install && \
    rm -rf /code/


    ### -----------------------------------------------------
    ### Build the application
    ### -----------------------------------------------------
    FROM build-aws-sdk-cpp as build-app
    WORKDIR /code/
    COPY . .
    ARG APP_BUILD_TYPE
    ENV APP_BUILD_TYPE="${APP_BUILD_TYPE}"
    RUN rm -rf build && cmake -S . -B build -DCMAKE_BUILD_TYPE="${APP_BUILD_TYPE}"
    WORKDIR /code/build/
    RUN make
    # Default region N.Virginia

    关于c++ - 在 Ubuntu 上使用 cmake 安装 AWS SDK C++,安装第三方库时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65829295/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com