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

Add support for building with MinGW #604

Closed
wants to merge 1 commit into from

Conversation

trilader
Copy link

@trilader trilader commented Mar 3, 2020

Issue #, if available:

Description of changes:
This PR makes it possible to build aws-c-common with the MinGW toolchain on Windows.

The main changes are adding checks for the __MINGW32__ define which is preset on both 32 and 64 bit MinGW installations. Additionally MinGW needs changes related to format strings such as defining __USE_MINGW_ANSI_STDIO and using the gnu_printf attribute.

Building with MSVC still works as before these changes. The test pass on both MinGW and MSVC.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@graebm graebm left a comment

Choose a reason for hiding this comment

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

Sorry it took so long to notice this PR
Good work!

include/aws/common/byte_order.inl Outdated Show resolved Hide resolved
#pragma warning(disable : 4996)
#ifndef __MINGW32__
# pragma warning(push)
# pragma warning(disable : 4996)
Copy link
Contributor

Choose a reason for hiding this comment

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

please comment what warning this disables (and say why if it's not immediately obvious why one would disable it)

For example, this is how we usually disable some MSVC-specific warnings

#if _MSC_VER
#    pragma warning(disable : 4221) /* aggregate initializer using local variable addresses */
#    pragma warning(disable : 4204) /* non-constant aggregate initializer */
#endif

Copy link
Author

Choose a reason for hiding this comment

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

This (and the same construct in system_info.c) only looks like it's a newly disabled warning because of indentation changes. It's actually just disabling the MSVC specific #pragma when using MinGW as GCC can't understand MSVC warning codes.

@trilader trilader force-pushed the master branch 2 times, most recently from 58f298e to 37e5f51 Compare April 23, 2020 20:43
@trilader
Copy link
Author

trilader commented May 7, 2020

I've rebased to current master in order to trigger the CI again but it looks like it's still not working correctly

@ihnorton
Copy link

ihnorton commented Aug 6, 2020

Bump. As I mentioned over in aws/aws-sdk-cpp#1426, we are interested in support for the mingw-w64 target (as are others like @nealrichardson).

@graebm, I see you are now using github actions: would you accept a PR to add a mingw-w64 target to the build matrix?

@jeroen
Copy link

jeroen commented Aug 15, 2020

FYI, we have adopted a modified version of this patch in msys2 mingw-w64-aws-sdk-cpp. To install binaries from msys2 use

pacman -Syu
pacman -S mingw-w64-{i686,x86_64}-aws-sdk-cpp

@justinboswell justinboswell deleted the branch awslabs:master November 13, 2020 01:53
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.

5 participants