configure: fix WinIDN builds targeting old Windows#14680
Closed
vszakats wants to merge 6 commits intocurl:masterfrom
Closed
configure: fix WinIDN builds targeting old Windows#14680vszakats wants to merge 6 commits intocurl:masterfrom
vszakats wants to merge 6 commits intocurl:masterfrom
Conversation
f59d5b3 to
00dc9b6
Compare
All mingw-w64 versions declare these IDN function, but some mingw-envs
set the default _WIN32_WINNT value conservatively, e.g. to 0x0502. In
such case idn.c was assuming an old SDK env, assumed these declarations
missing and declared them. This caused duplicate declaration warnings.
Fix it by always skipping local declarations for mingw builds. (Classic
mingw may fail on that, but curl no longer supports classic mingw)
I'm not sure why this wasn't happening with cmake builds in the same
build env.
Seen on Ubuntu mingw-w64 cross-builds.
```
../../lib/idn.c:154:23: error: redundant redeclaration of ‘IdnToAscii’ [-Werror=redundant-decls]
154 | WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags,
| ^~~~~~~~~~
In file included from /usr/share/mingw-w64/include/windows.h:73,
from /usr/share/mingw-w64/include/winsock2.h:23,
from ../../lib/setup-win32.h:91,
from ../../lib/curl_setup.h:308,
from ../../lib/idn.c:29:
/usr/share/mingw-w64/include/winnls.h:1075:30: note: previous declaration of ‘IdnToAscii’ was here
1075 | WINNORMALIZEAPI int WINAPI IdnToAscii (DWORD dwFlags, LPCWSTR lpUnicodeCharStr, int cchUnicodeChar, LPWSTR lpASCIICharStr, int cchASCIIChar);
| ^~~~~~~~~~
../../lib/idn.c:159:23: error: redundant redeclaration of ‘IdnToUnicode’ [-Werror=redundant-decls]
159 | WINBASEAPI int WINAPI IdnToUnicode(DWORD dwFlags,
| ^~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/windows.h:73,
from /usr/share/mingw-w64/include/winsock2.h:23,
from ../../lib/setup-win32.h:91,
from ../../lib/curl_setup.h:308,
from ../../lib/idn.c:29:
/usr/share/mingw-w64/include/winnls.h:1077:30: note: previous declaration of ‘IdnToUnicode’ was here
1077 | WINNORMALIZEAPI int WINAPI IdnToUnicode (DWORD dwFlags, LPCWSTR lpASCIICharStr, int cchASCIIChar, LPWSTR lpUnicodeCharStr, int cchUnicodeChar);
| ^~~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/10548869067/job/29223257811?pr=14680#step:7:90
This reverts commit 6c8068dfdecbef0390eac1c77e06b8db4e0fca5c.
Not good, this time with CMake, missing the original declarations:
They are guarded with in winnls.h:
```
#if WINVER >= 0x0600
```
```
/home/runner/work/curl/curl/lib/idn.c: In function ‘win32_idn_to_ascii’:
/home/runner/work/curl/curl/lib/idn.c:174:17: error: implicit declaration of function ‘IdnToAscii’; did you mean ‘ToAscii’? [-Wimplicit-function-declaration]
174 | int chars = IdnToAscii(0, in_w, (int)(wcslen(in_w) + 1), punycode,
| ^~~~~~~~~~
| ToAscii
/home/runner/work/curl/curl/lib/idn.c:174:17: error: nested extern declaration of ‘IdnToAscii’ [-Werror=nested-externs]
/home/runner/work/curl/curl/lib/idn.c: In function ‘win32_ascii_to_idn’:
/home/runner/work/curl/curl/lib/idn.c:204:17: error: implicit declaration of function ‘IdnToUnicode’; did you mean ‘ToUnicode’? [-Wimplicit-function-declaration]
204 | int chars = IdnToUnicode(0, in_w, (int)(wcslen(in_w) + 1), idn,
| ^~~~~~~~~~~~
| ToUnicode
/home/runner/work/curl/curl/lib/idn.c:204:17: error: nested extern declaration of ‘IdnToUnicode’ [-Werror=nested-externs]
```
Ref: https://github.com/curl/curl/actions/runs/10545946413/job/29216819270?pr=13947#step:11:76
Ref: curl#12684 Ref: curl#12606 (comment) Ref: curl@37f1c21
Originall added in 37f1c21 curl#7581 for classic mingw. curl no longer supports building with classic mingw. Ref: curl#12684 Ref: curl#12606 (comment)
00dc9b6 to
f4cb57b
Compare
13 tasks
jay
approved these changes
Aug 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GHA/windows: enable WinIDN in Linux cross-builds.
(to reveal the issue in CI.)
fix compiler warning when building with mingw-w64 supporting
WinIDN, while targeting pre-Vista Windows, with a
WINVERset totarget Vista or newer. (Such was Ubuntu's mingw-w64 with the
classic-mingw-specific trick in point 3 of this PR.)
Ref: https://github.com/curl/curl/actions/runs/10542832783/job/29210098553#step:7:89
drop
WINVERoverride for classic-mingw. curl no longer supportsbuilding with classic-mingw.
Reverts 37f1c21 configure: set classic mingw minimum OS version to XP #7581
sync
if IdnToUnicode can be linkeddetection snippet with the livecode in
lib/idn.c. It fixes detection for the scenario in point 2.delete unused
WINIDN_DIRvariable.Bug: #12606 (comment)
Previous abandoned attempt: #12684