Fix MinGW build #2721

Closed
wants to merge 5 commits into
from

Conversation

Projects
None yet
2 participants
@MarcelRaad
Member

MarcelRaad commented Jul 8, 2018

Fixes some build errors and compiler warnings on original MinGW as well as MinGW-w64. See individual commits for details.

MarcelRaad added some commits Jul 8, 2018

examples: fix -Wformat warnings
When size_t is not a typedef for unsigned long (as usually the case on
Windows), GCC emits -Wformat warnings when using lu and lx format
specifiers with size_t. Silence them with explicit casts to
unsigned long.
curl_setup: include <winerror.h> before <windows.h>
Otherwise, only part of it gets pulled in through <windows.h> on
original MinGW.

Fixes #2361
schannel: make more cipher options conditional
They are not defined in the original MinGW's <wincrypt.h>.
schannel: workaround for wrong function signature in w32api
Original MinGW's w32api has CryptHashData's second parameter as BYTE *
instead of const BYTE *.
schannel: fix -Wsign-compare warning
MinGW warns:
/lib/vtls/schannel.c:219:64: warning: signed and unsigned type in
conditional expression [-Wsign-compare]

Fix this by casting the ptrdiff_t to size_t as we know it's positive.
@bagder

bagder approved these changes Jul 8, 2018

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 9, 2018

curl_setup: include <winerror.h> before <windows.h>
Otherwise, only part of it gets pulled in through <windows.h> on
original MinGW.

Fixes curl#2361
Closes curl#2721

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 9, 2018

schannel: make more cipher options conditional
They are not defined in the original MinGW's <wincrypt.h>.

Closes curl#2721

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 9, 2018

schannel: workaround for wrong function signature in w32api
Original MinGW's w32api has CryptHashData's second parameter as BYTE *
instead of const BYTE *.

Closes curl#2721

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 9, 2018

schannel: fix -Wsign-compare warning
MinGW warns:
/lib/vtls/schannel.c:219:64: warning: signed and unsigned type in
conditional expression [-Wsign-compare]

Fix this by casting the ptrdiff_t to size_t as we know it's positive.

Closes curl#2721

@MarcelRaad MarcelRaad closed this in 5bd8c38 Jul 9, 2018

@MarcelRaad MarcelRaad deleted the MarcelRaad:mingw_fixes branch Jul 9, 2018

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Jul 9, 2018

Member

@MarcelRaad, should there have been one more algo #ifdef'ed? See this mingw build failure from the push.

Member

bagder commented Jul 9, 2018

@MarcelRaad, should there have been one more algo #ifdef'ed? See this mingw build failure from the push.

@MarcelRaad

This comment has been minimized.

Show comment
Hide comment
@MarcelRaad

MarcelRaad Jul 10, 2018

Member

@bagder That's apparently a typo in MinGW's Windows SDK, w32api. I have patched this locally in w32api as CALG_TLS1PRF is defined but unusable and the undefined ALG_CLASS_DHASH is ALG_CLASS_HASH in the original Microsoft Windows SDK.

We could #ifdef on original MinGW, but then users cannot just fix their w32api. But fixing the autobuilds is probably more important?

I've created a ticket here: https://osdn.net/projects/mingw/ticket/38391

Member

MarcelRaad commented Jul 10, 2018

@bagder That's apparently a typo in MinGW's Windows SDK, w32api. I have patched this locally in w32api as CALG_TLS1PRF is defined but unusable and the undefined ALG_CLASS_DHASH is ALG_CLASS_HASH in the original Microsoft Windows SDK.

We could #ifdef on original MinGW, but then users cannot just fix their w32api. But fixing the autobuilds is probably more important?

I've created a ticket here: https://osdn.net/projects/mingw/ticket/38391

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Jul 10, 2018

Member

fixing the autobuilds is probably more important?

Yeah, I consider that fairly important and getting mingw fixed and deployed sounds like a potentially rather slow operation...

What about doing a local "kludge" with a comment explaining the reasoning and a date for when we can try to remove it again?

Member

bagder commented Jul 10, 2018

fixing the autobuilds is probably more important?

Yeah, I consider that fairly important and getting mingw fixed and deployed sounds like a potentially rather slow operation...

What about doing a local "kludge" with a comment explaining the reasoning and a date for when we can try to remove it again?

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 10, 2018

schannel: fix MinGW compile break
Original MinGW's w32api has a sytax error in its definition of
CALG_TLS1PRF [0]. Don't use original MinGW w32api's CALG_TLS1PRF
until this bug [1] is fixed.

[0] https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/d1d4a17e51a2b78e252ef0147d483267d56c90cc/w32api/include/wincrypt.h
[1] https://osdn.net/projects/mingw/ticket/38391

Fixes curl#2721 (comment)
Closes

MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 11, 2018

schannel: fix MinGW compile break
Original MinGW's w32api has a sytax error in its definition of
CALG_TLS1PRF [0]. Don't use original MinGW w32api's CALG_TLS1PRF
until this bug [1] is fixed.

[0] https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/blobs/d1d4a17e51a2b78e252ef0147d483267d56c90cc/w32api/include/wincrypt.h
[1] https://osdn.net/projects/mingw/ticket/38391

Fixes curl#2721 (comment)
Closes curl#2728
@MarcelRaad

This comment has been minimized.

Show comment
Hide comment
@MarcelRaad

MarcelRaad Jul 12, 2018

Member

Strange, it works for me, but the autobuild still fails:
https://curl.haxx.se/dev/log.cgi?id=20180712040614-17491#prob3

@mback2k Could you tell me what this tester's w32api.h says about the version macros, please? Are __W32API_VERSION, __W32API_MAJOR_VERSION, __W32API_MINOR_VERSION, and __W32API_PATCHLEVEL defined?

Member

MarcelRaad commented Jul 12, 2018

Strange, it works for me, but the autobuild still fails:
https://curl.haxx.se/dev/log.cgi?id=20180712040614-17491#prob3

@mback2k Could you tell me what this tester's w32api.h says about the version macros, please? Are __W32API_VERSION, __W32API_MAJOR_VERSION, __W32API_MINOR_VERSION, and __W32API_PATCHLEVEL defined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment