Skip to content
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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kou
Copy link

@kou kou commented Feb 28, 2025

Issue #, if available: #3315

Description of changes:

This just shows how to setup mingw-w64 build environment with MSYS2.

This uses GitHub Actions but we'll use internal CI build system instead of GitHub Actions.

The added workflow has 2 jobs. One job applies a patch ( https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-aws-sdk-cpp/aws-sdk-cpp-pr-1333.patch ) in MSYS2 and another job builds aws-sdk-cpp as-is.

Both jobs do the followings:

  1. Setup build environment with MSYS2
  2. Run cmake
  3. Build

I'll add review comments for details.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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

- 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.

- false
env:
MINGW_PACKAGE_PREFIX: mingw-w64-ucrt-x86_64
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.

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.

Comment on lines +32 to +37
${MINGW_PACKAGE_PREFIX}-cc \
${MINGW_PACKAGE_PREFIX}-cmake \
${MINGW_PACKAGE_PREFIX}-curl \
${MINGW_PACKAGE_PREFIX}-ninja \
${MINGW_PACKAGE_PREFIX}-openssl \
${MINGW_PACKAGE_PREFIX}-zlib
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)

${MINGW_PACKAGE_PREFIX}-ninja \
${MINGW_PACKAGE_PREFIX}-openssl \
${MINGW_PACKAGE_PREFIX}-zlib
- 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.

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.

cmake \
-B build \
-DAWS_SDK_WARNINGS_ARE_ERRORS=OFF \
-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.

-B build \
-DAWS_SDK_WARNINGS_ARE_ERRORS=OFF \
-DBUILD_ONLY="s3;s3-crt;dynamodb;logs;kms;sqs;firehose;kinesis;sns;mediastore;mediastore-data;monitoring;secretsmanager;athena;kafka;cognito-idp;rds;ecs" \
-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.

-DAWS_SDK_WARNINGS_ARE_ERRORS=OFF \
-DBUILD_ONLY="s3;s3-crt;dynamodb;logs;kms;sqs;firehose;kinesis;sns;mediastore;mediastore-data;monitoring;secretsmanager;athena;kafka;cognito-idp;rds;ecs" \
-DBUILD_SHARED_LIBS=OFF \
-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.

@kou kou mentioned this pull request Feb 28, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant