Skip to content

AWS SDK for c++ build failure: HttpClientTest.cpp:146: Failure

0

Hello, I'm trying to build the aws sdk in my docker image following these commands:


FROM ubuntu:22.04 

RUN apt update && \
    apt install -y ca-certificates build-essential uuid-dev libpulse-dev g++ cmake  git libcurl4-openssl-dev \
     zlib1g-dev wget libssl-dev --no-install-recommends && \
    apt-get autoremove -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*


RUN cd /app/src && \
    git clone --depth 1 --recurse-submodules https://github.com/aws/aws-sdk-cpp && \
    mkdir -p /app/src/aws-sdk-cpp/build && \
    cd /app/src/aws-sdk-cpp/build && \
    cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="sqs" -DCMAKE_PREFIX_PATH=/usr/local/ -DCMAKE_INSTALL_PREFIX=/usr/local && \
    make -j$(nproce) && make install

The docker build fails in my local machine but it fails when I run it from my work machine with this error.

error	26-Aug-2024 18:51:35	#11 305.0 /app/src/aws-sdk-cpp/tests/aws-cpp-sdk-core-tests/utils/threading/ReaderWriterLockTest.cpp:92: Skipped
error	26-Aug-2024 18:51:35	#11 305.0 Test is temporarily disabled
error	26-Aug-2024 18:51:37	#11 306.4 selected scheme id=aws.auth#sigv4a
error	26-Aug-2024 18:51:37	#11 306.4 selected scheme id=aws.auth#sigv4
error	26-Aug-2024 18:51:37	#11 306.4 Final auth=AWS4-HMAC-SHA256 Credential=dummyAccessId/20240826/us-west2/MyService/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=2e2f660ead5ed298d4de71cc838aa96e28d4ebabe89d34af4e26fbf018526060
error	26-Aug-2024 18:52:11	#11 340.8 /app/src/aws-sdk-cpp/tests/aws-cpp-sdk-core-tests/http/HttpClientTest.cpp:146: Failure
error	26-Aug-2024 18:52:11	#11 340.8 Value of: hasPendingTasks
error	26-Aug-2024 18:52:11	#11 340.8   Actual: true
error	26-Aug-2024 18:52:11	#11 340.8 Expected: false
error	26-Aug-2024 18:52:21	#11 350.9 [  FAILED  ] HttpClientTest.TestRandomURLMultiThreaded (16160 ms)
error	26-Aug-2024 18:52:35	#11 364.4 /app/src/aws-sdk-cpp/tests/aws-cpp-sdk-core-tests/utils/memory/AWSMemoryTest.cpp:105: Skipped

Is there a way to fix this? Are there network requirements for build the sdk?

asked a year ago257 views
1 Answer
0

You can modify your Dockerfile to skip the tests by passing the -DENABLE_TESTING=OFF flag to the cmake command. This will prevent the tests from being built and executed, which should resolve the errors you're seeing.

Here’s an updated version of your Dockerfile:

FROM ubuntu:22.04 

# Install dependencies
RUN apt update && \
    apt install -y ca-certificates build-essential uuid-dev libpulse-dev g++ cmake git libcurl4-openssl-dev \
    zlib1g-dev wget libssl-dev --no-install-recommends && \
    apt-get autoremove -y && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Clone AWS SDK for C++ and build it
RUN cd /app/src && \
    git clone --depth 1 --recurse-submodules https://github.com/aws/aws-sdk-cpp && \
    mkdir -p /app/src/aws-sdk-cpp/build && \
    cd /app/src/aws-sdk-cpp/build && \
    cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="sqs" -DCMAKE_PREFIX_PATH=/usr/local/ -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_TESTING=OFF && \
    make -j$(nproc) && make install

This approach ensures that your build process is focused purely on compiling the SDK and avoids any test-related errors.

AWS
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.