Skip to content

Add AWS CodeBuild workflow and Dockerfile for ArchLinux #161

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

Merged
merged 6 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ci/codebuild/arch-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 0.2
# This uses the docker image specified in ci/docker/arch-linux
phases:
build:
commands:
- echo Build started on `date`
- ./ci/codebuild/build.sh -DTEST_RESOURCE_PREFIX=lambda-cpp-archbtw
- ./ci/codebuild/run-tests.sh aws-lambda-package-lambda-test-fun
- echo Build completed on `date`
6 changes: 5 additions & 1 deletion ci/codebuild/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ set -euo pipefail
cd $CODEBUILD_SRC_DIR
mkdir build
cd build
cmake .. -GNinja -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/install $@
cmake .. -GNinja \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=/install $@
ninja
ninja install
22 changes: 22 additions & 0 deletions ci/docker/arch-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM public.ecr.aws/docker/library/archlinux:latest

RUN pacman -Sy --noconfirm git
RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git
RUN pacman -Sy --noconfirm \
cmake \
ninja \
clang \
curl \
zip


# Note: (2022-08-23)
# Using -DUSE_OPENSSL=OFF as a workaround to an AWS SDK dependency issue with this distro.
# The current SDK version has a dependency on a static build version of openssl, not available through pacman.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not available as a built package from the main repositories. If you build openssl-static from the AUR with makepkg, the resulting package can be installed with pacman -U <package-file>.

# ref: https://github.com/aws/aws-sdk-cpp/issues/1910
RUN CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -Saws-sdk-cpp -Baws-sdk-cpp/build -GNinja \
-DBUILD_ONLY=lambda \
-DUSE_OPENSSL=OFF \
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fun one - basically, because reasons (aws/aws-sdk-cpp#1910), including the current version of AWS SDK into the project (as the tests do) - CMake barfs at test time (./ci/codebuild/build.sh in arch-linux.yml) complaining about not being able to find openssl, enough though it was found just fine when doing the SDK build + install! For the other build environments we have, something like yum install -y openssl-static is resolving the dependency, but an equivalent package is not available (that I could find anyways) in this distro.

So... the workaround I've been doing is using the experimental S2N support in the SDK, triggered by this flag. This works fine, but also brought along the requirement to use clang instead of gcc due to differences in warnings/errors reported on when Came compiled with this distro's gcc/g++.

🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes!
You should probably put that blurb of reasoning as a comment in the docker file.
I wish the C++ SDK never adopted the CRT. Oh Well!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a shorter version of this comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Arch linux, the AUR has a package openssl-static.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If desired, it could be installed with:

git clone --depth 1 https://aur.archlinux.org/openssl-static.git
cd openssl-static
makepkg -si --noconfirm --skippgpcheck

However, it will build openssl from source, which takes quite a while.

-DENABLE_TESTING=OFF
RUN cmake --build aws-sdk-cpp/build -t install