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

Fix MinGW build #2721

Closed
wants to merge 5 commits into from
Closed

Fix MinGW build #2721

wants to merge 5 commits into from

Conversation

MarcelRaad
Copy link
Member

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

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.
Otherwise, only part of it gets pulled in through <windows.h> on
original MinGW.

Fixes curl#2361
They are not defined in the original MinGW's <wincrypt.h>.
Original MinGW's w32api has CryptHashData's second parameter as BYTE *
instead of const BYTE *.
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.
MarcelRaad added a commit to MarcelRaad/curl that referenced this pull request Jul 9, 2018
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
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
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
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 mingw_fixes branch July 9, 2018 16:11
@bagder
Copy link
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
Copy link
Member Author

@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
Copy link
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
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
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
Copy link
Member Author

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?

falconindy pushed a commit to falconindy/curl that referenced this pull request Sep 10, 2018
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.

Closes curl#2721
falconindy pushed a commit to falconindy/curl that referenced this pull request Sep 10, 2018
Otherwise, only part of it gets pulled in through <windows.h> on
original MinGW.

Fixes curl#2361
Closes curl#2721
falconindy pushed a commit to falconindy/curl that referenced this pull request Sep 10, 2018
They are not defined in the original MinGW's <wincrypt.h>.

Closes curl#2721
falconindy pushed a commit to falconindy/curl that referenced this pull request Sep 10, 2018
Original MinGW's w32api has CryptHashData's second parameter as BYTE *
instead of const BYTE *.

Closes curl#2721
falconindy pushed a commit to falconindy/curl that referenced this pull request Sep 10, 2018
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
falconindy pushed a commit to falconindy/curl that referenced this pull request Sep 10, 2018
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
@lock lock bot locked as resolved and limited conversation to collaborators Oct 10, 2018
@mback2k
Copy link
Member

mback2k commented Nov 12, 2018

@MarcelRaad I guess your question above was answered within #2924, right? Or are there any issues remaining I could test now that my build environment is running again?

@MarcelRaad
Copy link
Member Author

Everything is clear now, thanks @mback2k !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants