-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
build: add Windows CE / CeGCC support, with CI jobs #15975
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
27fe00d
to
e618b6b
Compare
4163f40
to
cf2f23b
Compare
- fix `find` commands to not miss items. - call `file` on the built files in `curl -V` steps. To give more feedback on what was built. - add `curl info` step for cross-jobs that can't do a `curl -V`. It lists the files built and calls `file` on them. - appveyor: make a VS2010 32-bit to match the VS2008 job it replaced. Follow-up to d34aeec #15934 - GHA/windows: drop the word "old" from standalone mingw-w64 jobs to not conflate it with "old mingw" we no longer support (while also keeping it short). Cherry-picked from #15975 Closes #16001
c5f56be
to
56e28ae
Compare
To use the "ANSI" API flavor.
It'd a build case when using VS2015 for WinCE. I haven't tried this and also not tested in CI. Excluding it because ALPN is very unlikely to have support under CE, but if it is, it's possible to adjust the detection code, and even the wind detection can be made WinCE compatible by adding a couple of lines.
Are you thinking to add vcpkg to compile with windows CE? |
Does vcpkg support Windows CE via mingw32ce? |
vcpkg support mingw in community. I can try to see if it works with that mingw. |
Sounds good to me! This is a rather niche mingw (based on the old-mingw Another interesting challenge would be making a WinCE build with either There is also the "revived" mingw32ce, but it needs to be built from source Also, actually running any of these builds under an emulator would be interesting, |
@vszakats why you run wince under macos? can you try on linux? |
Pre-built CeGCC binaries are available for macOS and Windows. Of these, the to unixy macOS runner is faster and easier to work Linux would be nicer but this isn't officially packaged, external |
will you try from here? |
These are the binaries I was working with, and what's used in CI. |
Follow-up to e49797a curl#16022 Follow-up to 2a292c3 curl#15975 Cherry-picked from curl#16394
Forgot to mention it publicly: With
Maybe there is a better solution; I didn't explore this rabbit hole in depth. |
Follow-up to e49797a curl#16022 Follow-up to 2a292c3 curl#15975 Cherry-picked from curl#16394 Closes curl#16455
As long ssize_t has a size of signed size_t type (int I'd assume in this case) I don't see a problem |
Yes, it should be the case. Which made me think this is possibly a GCC bug and not worth addressing. Maybe there is a |
test: #16492 (comment) |
This patch seems to work to fix (=silence) it: e6359ca The next question is why does autotools want to detect C11 and C99 in these builds, and not in others:
https://github.com/curl/curl/actions/runs/13534146058/job/37822577315?pr=16492#step:6:74 vs. a normal mingw builds:
https://github.com/curl/curl/actions/runs/13534146058/job/37822579122?pr=16492#step:7:73 |
`./configure` mingw32ce builds enable C99 mode automatically, that triggers compiler warnings in gcc 4.4.0. We initially worked it around in CI by suppressing the detection of C99 with `ac_cv_prog_cc_c99=no`. Replace it with automatically silencing the bogus warnings in C99 mode, for all build systems: ``` lib/ftp.c: In function 'Curl_GetFTPResponse': lib/ftp.c:726: error: format '%zd' expects type 'signed size_t', but argument 4 has type 'ssize_t' lib/ws.c: In function 'ws_dec_pass_payload': lib/ws.c:304: error: format '%zd' expects type 'signed size_t', but argument 3 has type 'ssize_t' lib/ws.c: In function 'ws_enc_write_head': lib/ws.c:581: error: format '%zd' expects type 'signed size_t', but argument 3 has type 'long int' lib/vtls/schannel.c: In function 'schannel_connect_step1': lib/vtls/schannel.c:1122: error: format '%zd' expects type 'signed size_t', but argument 3 has type 'ssize_t' lib/vtls/schannel.c: In function 'schannel_connect_step2': lib/vtls/schannel.c:1311: error: format '%zd' expects type 'signed size_t', but argument 3 has type 'ssize_t' lib/vtls/schannel.c: In function 'schannel_send': lib/vtls/schannel.c:1793: error: format '%zd' expects type 'signed size_t', but argument 3 has type 'ssize_t' lib/vtls/schannel.c:1810: error: format '%zd' expects type 'signed size_t', but argument 3 has type 'ssize_t' lib/vtls/schannel.c: In function 'schannel_shutdown': lib/vtls/schannel.c:2286: error: format '%zd' expects type 'signed size_t', but argument 4 has type 'ssize_t' lib/vtls/vtls.c: In function 'ssl_cf_recv': lib/vtls/vtls.c:1422: error: format '%zd' expects type 'signed size_t', but argument 5 has type 'ssize_t' ``` Ref: https://github.com/curl/curl/actions/runs/13533841306/job/37821720902?pr=16492#step:9:20 Also: simplify Windows CE job configuration in GHA/windows. Follow-up to 2a292c3 #15975 Closes #16492
…allouts - GHA/windows/WinCE: - set `-O3 -DNDEBUG` C flags manually for the CMake mingw32ce build. CMake doesn't recognize the platform and fails to add them. To match autotools (using `-O2`), and hit similar compiler warnings. - enable parallel builds for cmake. - tune parallelism for cmake using unity batches. - tune parallelism for autotools. Follow-up to 2a292c3 #15975 - tests: fix potentially uninitialized value in `readline()` in `getpart.c`. Detected by gcc 4.4.0 `-O2` (Windows CE) jobs: ``` tests/server/getpart.c: In function 'getpart': tests/server/getpart.c:298: error: 'datalen' may be used uninitialized in this function ``` Ref: https://github.com/curl/curl/actions/runs/13522595237/job/37785147505?pr=16476#step:11:25 Follow-up to 592880a - vtls_scache: rework returning pointer to avoid compiler warning seen with `-O3` gcc 4.4.0 builds (Windows CE/schannel): ``` lib/vtls/schannel.c: In function 'schannel_connect_step1': lib/vtls/vtls_scache.c:975: error: dereferencing pointer 'old_cred.4474' does break strict-aliasing rules lib/vtls/vtls_scache.c:985: error: dereferencing pointer 'old_cred.4474' does break strict-aliasing rules lib/vtls/schannel.c:959: note: initialized from here ``` Ref: https://github.com/curl/curl/actions/runs/13523868335/job/37789610845#step:9:25 Follow-up to fa0ccd9 #15774 Closes #16476
Make it possible to build curl for Windows CE using the CeGCC toolchain.
With both CMake and autotools, including tests and examples, also in CI.
The build configuration is the default one with Schannel enabled. No
3rd-party dependencies have been tested.
Also revive old code to make Schannel build with Windows CE, including
certificate verification.
Builds have been throughougly tested. But, I've made no functional tests
for this PR. Some parts (esp. file operations, like truncate and seek)
are stubbed out and likely broken as a result. Test servers build, but
they do not work on Windows CE. This patch substitutes
fstat()
callswith
stat()
, which operate on filenames, not file handles. This may ormay not work and/or may not be secure.
About CeGCC: I used the latest available macOS binary build v0.59.1
r1397 from 2009, in native
mingw32ce
build mode. CeGCC is in effectMinGW + GCC 4.4.0 + old/classic-mingw Windows headers. It targets
Windows CE v3.0 according to its
_WIN32_WCE
value. It means this PRrestores portions of old/classic-mingw support. It makes the Windows CE
codepath compatible with GCC 4.4.0. It also adds workaround for CMake,
which cannot identify and configure this toolchain out of the box.
Notes:
with Amiga and MS-DOS.
MINGW
for mingw32ce. Set it andMINGW32CE
manually as a helper variable, in addition to
WINCE
which CMake setsbased on
CMAKE_SYSTEM_NAME
.libcurl.dll
, due to notrecognizing the platform as a Windowsy one. This patch adds the
necessary workaround to make it work.
support. Fixed by restoring and renovating code previously deleted
old-mingw code.
mingw32ce, old-mingw, or GCC version-specific.
wmain
,GetProcAddress()
._fileno()
is said to convert fromFILE *
tovoid *
which isa Win32 file
HANDLE
. (This patch doesn't use this, but with furthereffort it probably could be.)
https://stackoverflow.com/questions/3989545/how-do-i-get-the-file-handle-from-the-fopen-file-structure
_get_osfhandle()
, noerrno
, noerrno.h
. Some of this stuff isstandard C89, yet missing from this platform. Microsoft expects
Windows CE apps to use Win32 file API and
FILE *
exclusively.https://building.enlyze.com/posts/a-new-windows-ce-x86-compiler-in-2024/
On
UNDER_CE
vs._WIN32_WCE
: (This patch settled onUNDER_CE
)The compiler binaries don't contain these strings, and has no compiler
option for targeting WinCE, hinting that a vanilla toolchain isn't
setting any of them either.
UNDER_CE
is automatically defined by the CeGCC compiler.https://cegcc.sourceforge.net/docs/details.html
UNDER_CE
is similar to_WIN32
, except it's not set automaticallyby all compilers. It's not supposed to have any value, like a version.
(Though e.g. OpenSSL sets it to a version)
_WIN32_WCE
is the CE counterpart of the non-CE_WIN32_WINNT
macro.That does return the targeted Windows CE version.
_WIN32_WCE
is not defined by compilers, and relies on a headersetting it to a default, or the build to set it to the desired target
version. This is also how
_WIN32_WINNT
works._WIN32_WCE
default is set bywindef.h
in CeGCC._WIN32_WCE
isn't set to a default by MSVC Windows CE headers (theones I checked at least).
_WIN32_WCE=<ver>
,UNDER_CE
,WINCE
for MSVC WinCE._WIN32_WCE
seems more popular in other projects, including CeGCCitself.
zlib
is a notable exception amongst curl dependencies,which uses
UNDER_CE
._WIN32_WCE
needs "certain" headers to have it defined, it'sundefined depending on headers included beforehand.
curl/curl.h
re-uses_WIN32_WCE
's as a self-guard, relying onits not-(necessarily)-defined-by-default property:
curl/include/curl/curl.h
Line 77 in 25b445e
Toolchain downloads:
https://downloads.sourceforge.net/cegcc/cegcc/0.59.1/cegcc_mingw32ce_cygwin1.7_r1399.tar.bz2
https://downloads.sourceforge.net/cegcc/cegcc/0.59.1/cegcc_mingw32ce_snowleopard_r1397.tar.bz2
w/o whitespace: https://github.com/curl/curl/pull/15975/files?w=1
HAVE_SIGNAL_H
,HAVE_ERRNO_H
? They are C89, yet WinCE chose not to support them.96c2990 build: delete checks for C89 standard headers #11940
fe3463e build: assume errno.h is always available #9986
SKIP, it's enough to do this once there is one more platform with such need.
get_winapi_error()
from lib to re-use in tests. (replacing the copy-pasted duplicate)UNDER_CE
vs._WIN32_WCE
. →UNDER_CE