Skip to content

Don't merge: Add a GitHub Actions workflow for mingw-w64 with MSYS2 #3319

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
65 changes: 65 additions & 0 deletions .github/workflows/mingw-w64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: mingw-w64

on:
- push
- pull_request

jobs:
build:
name: Build
runs-on: windows-latest
Copy link
Author

Choose a reason for hiding this comment

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

It uses Windows 2022. GitHub Actions runner for Windows 2022 has MSYS2: https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#msys2

So, this doesn't install MSYS2 explicitly.

We can install MSYS2 via command line: https://www.msys2.org/docs/installer/#cli-usage-examples

strategy:
fail-fast: false
matrix:
with-patch:
- true
- false
env:
MINGW_PACKAGE_PREFIX: mingw-w64-ucrt-x86_64
Copy link
Author

Choose a reason for hiding this comment

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

This environment variable isn't required. It's just for reusing the same value.

MSYSTEM: UCRT64
Copy link
Author

Choose a reason for hiding this comment

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

This environment variable is required. bash -l (using bash as a login shell) refers this environment variable and setup PATH and so on.

steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: dependencies
shell: c:\msys64\usr\bin\bash.exe -e -l {0}
Copy link
Author

Choose a reason for hiding this comment

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

-l (login shell) is important here.

If we don't have -l, mingw-w64 build environment isn't prepared.

run: |
pacman \
--needed \
--noconfirm \
--sync \
${MINGW_PACKAGE_PREFIX}-cc \
${MINGW_PACKAGE_PREFIX}-cmake \
${MINGW_PACKAGE_PREFIX}-curl \
${MINGW_PACKAGE_PREFIX}-ninja \
Copy link
Author

Choose a reason for hiding this comment

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

We can use ${MINGW_PACKAGE_PREFIX}-make but Ninja is faster than Make.

${MINGW_PACKAGE_PREFIX}-openssl \
${MINGW_PACKAGE_PREFIX}-zlib
Comment on lines +32 to +37
Copy link
Author

Choose a reason for hiding this comment

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

${MINGW_PACKAGE_PREFIX} is mingw-w64-ucrt-x86_64.

It means:

  • mingw-w64-ucrt: We use mingw-w64 GCC with universal C runtime
  • x86_64: We use Intel/AMD 64bit CPU (We can use aarch64 for Arm 64bit CPU)

- name: patch
Copy link
Author

Choose a reason for hiding this comment

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

This step applies only https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-aws-sdk-cpp/aws-sdk-cpp-pr-1333.patch .
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-aws-sdk-cpp/0001-fix-dll-import-libary-folder.patch isn't applied.

Because we need only the former for passing build. The latter is for fixing install location for shared library.

For now, the former patch is for static build. We can't build aws-sdk-cpp for shared library with the former patch. So we don't need the latter patch yet.

if: matrix.with-patch
Copy link
Author

Choose a reason for hiding this comment

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

shell: c:\msys64\usr\bin\bash.exe -e -l {0}
run: |
pacman \
--needed \
--noconfirm \
--sync \
patch
cd ${GITHUB_WORKSPACE}
curl https://raw.githubusercontent.com/msys2/MINGW-packages/refs/heads/master/mingw-w64-aws-sdk-cpp/aws-sdk-cpp-pr-1333.patch | \
patch -p1
- name: configure
shell: c:\msys64\usr\bin\bash.exe -e -l {0}
run: |
set -x
cmake \
-B build \
-DAWS_SDK_WARNINGS_ARE_ERRORS=OFF \
Copy link
Author

Choose a reason for hiding this comment

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

There are some warnings with mingw-w64.

-DBUILD_ONLY="s3;s3-crt;dynamodb;logs;kms;sqs;firehose;kinesis;sns;mediastore;mediastore-data;monitoring;secretsmanager;athena;kafka;cognito-idp;rds;ecs" \
Copy link
Author

Choose a reason for hiding this comment

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

This is same as the one in simple-build.yml.

-DBUILD_SHARED_LIBS=OFF \
Copy link
Author

Choose a reason for hiding this comment

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

We can't build shared library even with the patch in MSYS2.

-DENABLE_TESTING=OFF \
Copy link
Author

Choose a reason for hiding this comment

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

We can't build tests even with the patch in MSYS2.

-GNinja \
-S ${GITHUB_WORKSPACE}
- name: build
shell: c:\msys64\usr\bin\bash.exe -e -l {0}
run: |
cmake --build build