Repository navigation
Conversation
e587a28 to
f957c00
Compare
4153957 to
29c5e58
Compare
|
As a sub-project I tried figuring out why the VS2008 It turns out it crashes in Why only the debug build is affected? Because in debug builds, edit: Yep, it also happens in non-Debug-enabled builds, when the |
|
A favourite kind of error message is "file not found" without telling the filename: This time from the Windows OS (or Visual Studio CRT?, or the shell?): |
dedcf12 to
e40da25
Compare
|
Phew... so linking against the shared CRT fixes the VS2008 crash issue. So, edit: Blindly speculating, the missing <dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>If that's the case I'm not sure how to fix this cleanly. updates:
update: With
|
ff0ab3c to
c8e9c5f
Compare
I have Visual Studio 2008 SP1 and cmake 3.18.1 installed on a Windows 7 machine.The reason MSVCR was "missing" is because Visual Studio 2008 uses Microsoft's side-by-side versioning and later Visual Studio versions don't. Without the manifest (ie I made only one change off of master ea07a64 to comment out the manifest removal and I was able to build curl with Visual Studio 2008 and cmake: It doesn't crash when I run it. This is in Windows 7 though. I remember at some point I had made some change to stderr to reroute it, so that --stderr would catch more stuff. That could have something to do with it. If there is anything else you want me to try let me know. (edit: I've since tried Also, have you ever tried CI jobs interactively like is it possible to remote desktop in and experiment that way? |
|
Thanks Jay. I figured the manifest thing out with some sweat and tears. Do you know a way to include our custom embedded manifest and also the auto-generated, sxs, one at the same time? (Out of curiosity, it's very niche and nobody ever reported it so not critical.) As for the crash it's a different issue, see my latest edits to the original message. It's happening with MSVCR* when linking curl with libcurl.dll and using CURL_STATIC_CRT=ON. (It's fine with UCRT) I used the interactive access in the past with curl-for-win, would have been handy now in retrospect, but slipped out of my mind. (Also contributed a security patch to it back then) |
|
I added
In some Visual Studio versions it's possible to use multiple manifests as long as the manifest is set to embed. In that case Visual Studio will merge the manifests. It may be possible by specifying the additional manifest file to embed unless Visual Studio 2008 doesn't support that. |
410d70a to
1f0cd3f
Compare
Have you tried with debug-enabled?: Release/Debug mode doesn't affect this, neither does Unity mode, according to CI tests.
This would need to maintain a separate copy of our custom manifest just for VS2008. But, but, Lines 116 to 124 in 4c50998 Lines 179 to 181 in e1b3d46 Unless I'm missing other reasons, the curl exe custom manifest seems safe to delete, along |
91ff123 to
82c9a55
Compare
7e43285 to
9e26602
Compare
|
After more tests I'm convinced that static CRT isn't meant for a shared Reverse this to repreduce: d5e55fb Which makes sense when we consider shared builds having two static CRTs Option added in #1621, and I don't think this was ever considered then I'll fix by limiting this option to static curl exe builds. Which is the same |
Static CRT crashes MSVCR* MSVC builds (in VS2008, VS2010, VS2012,
VS2013) according to CI and local tests. The reproducible crash happens
in `curl_mfprintf() -> fputc(s, stderr)` when trying to display the
warning message in `curl -V`. `stderr` is non-NULL and resolves to `2`.
This reproducer needs a debug-enabled build, but it's unrelated to debug
features or curl's memory tracker. It happens regardless of unity build,
CPU architecture or `DllMain()` use. Example from VS2013:
```
+ _bld/src/Debug/curl.exe --disable --version
./appveyor.sh: line 124: 203 Segmentation fault "${curl}" --disable --version
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/51570451/job/ojpdqrsm1hmpmq6a#L210
Another crash happened in an UCRT build (VS2017) with a couple of
`printf()`s added to curl's `main()` function:
```
Microsoft Visual C++ Runtime Library
Debug Assertion Failed!
Program: C:/projects/curl/bld/src/Debug/curl.exe
File: minkernel/crts/ucrt/src/appcrt/heap/debug_heap.cpp
Line: 996
Expression: _act_first_block == header
```
(it hangs the job in CI due to the GUI popup)
Ref: #16394 (comment)
To avoid actual and potential issues, this patch issues a warning on
the shared-libcurl + static-CRT combination and falls back to the
default, shared CRT. IOW a static CRT build now requires a static curl
exe when using the `CURL_STATIC_CRT=ON` option.
Follow-up to 4fc6ebe #1621
Cherry-picked from #16394 (with more details there)
Closes #16456
- appveyor: restore VS2008 job, after fixing its issues. Enable OpenSSL in it. It takes 1 minute. Follow-up to 9b0467b #16453 Follow-up to edfa537 #16456 - appveyor: make a copy of OpenSSL DLLs to have them picked up as an artifact (disabled by default) to aid local tests. - appveyor: dump CMake configuration logs on failure. - appveyor: tidy up job parameter defaults. - GHA/windows: add pre-fill check option for dl-mingw jobs. - GHA/windows: fix pre-fill check option for MSYS jobs by installing `diffutils`. Follow-up to e7adf3e #15841 - GHA/windows: de-duplicate to `PATH` commands for Cygwin. - GHA/windows: drop `$SYSTEMROOT/System32` from `PATH` for Cygwin configure. It's not needed. Follow-up to 36fd2dd #13599 - list `.pdb` files in curl version step for MSVC. Ref: #16439 Cherry-picked from #16394 Closes #16458
To save configuration time. After this patch, on Windows there remains 3 size detections. Those depend on 32/64-bitness and on other things for `time_t`. Cherry-picked from curl#16394
|
Closing in favour of the PRs this got split into. |
Support multi-target cmake builds via `CURL_DIRSUFFIX` env. For example:
`export CURL_DIRSUFFIX=Debug/`.
Multi-target generators place their output to `src/<subdir>/`,
`lib/<subdir>/`, `tests/server/<subdir>`, `tests/libtest/<subdir>` and
`tests/unit/<subdir>/` by default. Before this patch, `runtests.pl`
couldn't run on such builds because it expected the binaries under the
their `<subdir>`-less directories. This patch allows to set such subdir
and make `runtests.pl` find the binaries. In CI we use multi-target
builds with tests for MSVC. It also helps Xcode-generator builds, though
in CI we don't have such job running tests.
There may be better solutions to configure this, but passing a custom
value to `runtests.pl` including its subprocesses is somewhat tricky.
The reason the configuration value expects the slash at the end is
because MSYS is automagically expanding the env to a (wrong) absolute
path if the slash is in the front.
Also:
- drop the `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` workaround from CI.
- replace `resolve` references in tests with a new `%RESOLVE` variable.
It didn't use a filename extension before. After this patch it uses
`exe_ext('TOOL')`. I'm not sure if this is the correct choice vs.
`exe_ext('SRV')`.
- fix `-c` option format in manual.
- fix some whitespace.
Note, in CI we still tweak `CMAKE_RUNTIME_OUTPUT_DIRECTORY_*` in jobs
which share steps between `./configure` and cmake. It's easier that way.
Ref: curl#15000
Cherry-picked from curl#16394
Closes curl#16452
curl requires Windows XP since 2023. Drop version detection code using `GetVersionEx()` aimed to support earlier Windows versions. With that call deleted, the embedded manifest in `curl.rc` becomes unnecessary. Delete it too, along with the enabler logic in build systems. This allows to stop forcing `/MANIFEST:NO` for MSVC builds. Dropping it fixes VS2008 shared builds, that require an auto-generated SxS (side-by-side assembly) manifest to find their CRT DLLs. This was the issue that prevented VS2008 `curl.exe` launching on AppVeyor CI: ``` src/curl.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/51577006/job/eitypvwlb1rxr11d#L261 FWIW the `curl.rc` embedded manifest wasn't ever enabled for VS2008 CI builds either, because CMake did not pass our custom macro via `CMAKE_RC_FLAGS` to `rc.exe`. For reasons I could not figure out. After this patch the curl build no longer inject its own manifest, and lets the default be applied by linkers and toolchains. It fixes VS2008 shared builds. curl continues to detect the real Windows version via `RtlVerifyVersionInfo()` from `ntdll`. Follow-up to 960d601 curl#12225 Follow-up to 5044909 curl#7810 Follow-up to ebd2132 curl#1221 Ref: curl#15972 Cherry-picked from curl#16394 Closes curl#16453
Follow-up to e49797a curl#16022 Follow-up to 2a292c3 curl#15975 Cherry-picked from curl#16394 Closes curl#16455
Static CRT crashes MSVCR* MSVC builds (in VS2008, VS2010, VS2012,
VS2013) according to CI and local tests. The reproducible crash happens
in `curl_mfprintf() -> fputc(s, stderr)` when trying to display the
warning message in `curl -V`. `stderr` is non-NULL and resolves to `2`.
This reproducer needs a debug-enabled build, but it's unrelated to debug
features or curl's memory tracker. It happens regardless of unity build,
CPU architecture or `DllMain()` use. Example from VS2013:
```
+ _bld/src/Debug/curl.exe --disable --version
./appveyor.sh: line 124: 203 Segmentation fault "${curl}" --disable --version
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/51570451/job/ojpdqrsm1hmpmq6a#L210
Another crash happened in an UCRT build (VS2017) with a couple of
`printf()`s added to curl's `main()` function:
```
Microsoft Visual C++ Runtime Library
Debug Assertion Failed!
Program: C:/projects/curl/bld/src/Debug/curl.exe
File: minkernel/crts/ucrt/src/appcrt/heap/debug_heap.cpp
Line: 996
Expression: _act_first_block == header
```
(it hangs the job in CI due to the GUI popup)
Ref: curl#16394 (comment)
To avoid actual and potential issues, this patch issues a warning on
the shared-libcurl + static-CRT combination and falls back to the
default, shared CRT. IOW a static CRT build now requires a static curl
exe when using the `CURL_STATIC_CRT=ON` option.
Follow-up to 4fc6ebe curl#1621
Cherry-picked from curl#16394 (with more details there)
Closes curl#16456
Cherry-picked from curl#16394 Closes curl#16457
- appveyor: restore VS2008 job, after fixing its issues. Enable OpenSSL in it. It takes 1 minute. Follow-up to 9b0467b curl#16453 Follow-up to edfa537 curl#16456 - appveyor: make a copy of OpenSSL DLLs to have them picked up as an artifact (disabled by default) to aid local tests. - appveyor: dump CMake configuration logs on failure. - appveyor: tidy up job parameter defaults. - GHA/windows: add pre-fill check option for dl-mingw jobs. - GHA/windows: fix pre-fill check option for MSYS jobs by installing `diffutils`. Follow-up to e7adf3e curl#15841 - GHA/windows: de-duplicate to `PATH` commands for Cygwin. - GHA/windows: drop `$SYSTEMROOT/System32` from `PATH` for Cygwin configure. It's not needed. Follow-up to 36fd2dd curl#13599 - list `.pdb` files in curl version step for MSVC. Ref: curl#16439 Cherry-picked from curl#16394 Closes curl#16458
To save configuration time. After this patch, for mingw-w64 and MSVC curl's CMake builds pre-fill almost all type sizes without auto-detection. In most cases this leaves 3 type size auto-detections. Those depend on 64/32-bitness, and `time_t` also depends on CRT and custom options. Old mingw-w64 versions require some extra detections. We recommend v3.0 or newer to avoid them. For Windows CE, this patch pre-fills all type sizes. If this is causing any issue, please report it and disable pre-filling with `-D_CURL_PREFILL=OFF` in the meantime. Cherry-picked from #16394 Closes #16464
After this patch, we're back to 8.12.1, but disallowing `CURL_STATIC_CRT=ON` with shared curl exe built with VS2013 or older. Because those may crash. A stable reprducer is with `ENABLE_DEBUG=ON` and calling `curl.exe -V`. You can pass the necessary CMake and MSVC linker options manually, to get around this condition. Shared build with static UCRT may be crashing too, depending on conditions. Consult the documentation about limitations of static CRT: https://learn.microsoft.com/cpp/c-runtime-library/crt-library-features Follow-up to 049352d #16516 Follow-up to edfa537 #16456 Ref: #16394 Closes #16522
Support multi-target cmake builds via `CURL_DIRSUFFIX` env. For example:
`export CURL_DIRSUFFIX=Debug/`.
Multi-target generators place their output to `src/<subdir>/`,
`lib/<subdir>/`, `tests/server/<subdir>`, `tests/libtest/<subdir>` and
`tests/unit/<subdir>/` by default. Before this patch, `runtests.pl`
couldn't run on such builds because it expected the binaries under the
their `<subdir>`-less directories. This patch allows to set such subdir
and make `runtests.pl` find the binaries. In CI we use multi-target
builds with tests for MSVC. It also helps Xcode-generator builds, though
in CI we don't have such job running tests.
There may be better solutions to configure this, but passing a custom
value to `runtests.pl` including its subprocesses is somewhat tricky.
The reason the configuration value expects the slash at the end is
because MSYS is automagically expanding the env to a (wrong) absolute
path if the slash is in the front.
Also:
- drop the `-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_*=` workaround from CI.
- replace `resolve` references in tests with a new `%RESOLVE` variable.
It didn't use a filename extension before. After this patch it uses
`exe_ext('TOOL')`. I'm not sure if this is the correct choice vs.
`exe_ext('SRV')`.
- fix `-c` option format in manual.
- fix some whitespace.
Note, in CI we still tweak `CMAKE_RUNTIME_OUTPUT_DIRECTORY_*` in jobs
which share steps between `./configure` and cmake. It's easier that way.
Ref: curl#15000
Cherry-picked from curl#16394
Closes curl#16452
curl requires Windows XP since 2023. Drop version detection code using `GetVersionEx()` aimed to support earlier Windows versions. With that call deleted, the embedded manifest in `curl.rc` becomes unnecessary. Delete it too, along with the enabler logic in build systems. This allows to stop forcing `/MANIFEST:NO` for MSVC builds. Dropping it fixes VS2008 shared builds, that require an auto-generated SxS (side-by-side assembly) manifest to find their CRT DLLs. This was the issue that prevented VS2008 `curl.exe` launching on AppVeyor CI: ``` src/curl.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/51577006/job/eitypvwlb1rxr11d#L261 FWIW the `curl.rc` embedded manifest wasn't ever enabled for VS2008 CI builds either, because CMake did not pass our custom macro via `CMAKE_RC_FLAGS` to `rc.exe`. For reasons I could not figure out. After this patch the curl build no longer inject its own manifest, and lets the default be applied by linkers and toolchains. It fixes VS2008 shared builds. curl continues to detect the real Windows version via `RtlVerifyVersionInfo()` from `ntdll`. Follow-up to 960d601 curl#12225 Follow-up to 5044909 curl#7810 Follow-up to ebd2132 curl#1221 Ref: curl#15972 Cherry-picked from curl#16394 Closes curl#16453
Follow-up to e49797a curl#16022 Follow-up to 2a292c3 curl#15975 Cherry-picked from curl#16394 Closes curl#16455
Static CRT crashes MSVCR* MSVC builds (in VS2008, VS2010, VS2012,
VS2013) according to CI and local tests. The reproducible crash happens
in `curl_mfprintf() -> fputc(s, stderr)` when trying to display the
warning message in `curl -V`. `stderr` is non-NULL and resolves to `2`.
This reproducer needs a debug-enabled build, but it's unrelated to debug
features or curl's memory tracker. It happens regardless of unity build,
CPU architecture or `DllMain()` use. Example from VS2013:
```
+ _bld/src/Debug/curl.exe --disable --version
./appveyor.sh: line 124: 203 Segmentation fault "${curl}" --disable --version
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/51570451/job/ojpdqrsm1hmpmq6a#L210
Another crash happened in an UCRT build (VS2017) with a couple of
`printf()`s added to curl's `main()` function:
```
Microsoft Visual C++ Runtime Library
Debug Assertion Failed!
Program: C:/projects/curl/bld/src/Debug/curl.exe
File: minkernel/crts/ucrt/src/appcrt/heap/debug_heap.cpp
Line: 996
Expression: _act_first_block == header
```
(it hangs the job in CI due to the GUI popup)
Ref: curl#16394 (comment)
To avoid actual and potential issues, this patch issues a warning on
the shared-libcurl + static-CRT combination and falls back to the
default, shared CRT. IOW a static CRT build now requires a static curl
exe when using the `CURL_STATIC_CRT=ON` option.
Follow-up to 4fc6ebe curl#1621
Cherry-picked from curl#16394 (with more details there)
Closes curl#16456
Cherry-picked from curl#16394 Closes curl#16457
- appveyor: restore VS2008 job, after fixing its issues. Enable OpenSSL in it. It takes 1 minute. Follow-up to 9b0467b curl#16453 Follow-up to edfa537 curl#16456 - appveyor: make a copy of OpenSSL DLLs to have them picked up as an artifact (disabled by default) to aid local tests. - appveyor: dump CMake configuration logs on failure. - appveyor: tidy up job parameter defaults. - GHA/windows: add pre-fill check option for dl-mingw jobs. - GHA/windows: fix pre-fill check option for MSYS jobs by installing `diffutils`. Follow-up to e7adf3e curl#15841 - GHA/windows: de-duplicate to `PATH` commands for Cygwin. - GHA/windows: drop `$SYSTEMROOT/System32` from `PATH` for Cygwin configure. It's not needed. Follow-up to 36fd2dd curl#13599 - list `.pdb` files in curl version step for MSVC. Ref: curl#16439 Cherry-picked from curl#16394 Closes curl#16458
To save configuration time. After this patch, for mingw-w64 and MSVC curl's CMake builds pre-fill almost all type sizes without auto-detection. In most cases this leaves 3 type size auto-detections. Those depend on 64/32-bitness, and `time_t` also depends on CRT and custom options. Old mingw-w64 versions require some extra detections. We recommend v3.0 or newer to avoid them. For Windows CE, this patch pre-fills all type sizes. If this is causing any issue, please report it and disable pre-filling with `-D_CURL_PREFILL=OFF` in the meantime. Cherry-picked from curl#16394 Closes curl#16464
After this patch, we're back to 8.12.1, but disallowing `CURL_STATIC_CRT=ON` with shared curl exe built with VS2013 or older. Because those may crash. A stable reprducer is with `ENABLE_DEBUG=ON` and calling `curl.exe -V`. You can pass the necessary CMake and MSVC linker options manually, to get around this condition. Shared build with static UCRT may be crashing too, depending on conditions. Consult the documentation about limitations of static CRT: https://learn.microsoft.com/cpp/c-runtime-library/crt-library-features Follow-up to 049352d curl#16516 Follow-up to edfa537 curl#16456 Ref: curl#16394 Closes curl#16522
Limit this option to static-only curl builds. Enabling the static CRT for other configurations may successfuly build them, but executing them do run into nasty problems due to using two CRT copies at the same time. Also note that the static CRT setting applies to tests too, which revealed these issues. Also: - as it turns out, static CRT may be enabled for non-UCRT builds. After this patch, such configuration is possible again. - note, if these preconditions prevent doing a desired static-CRT build variation (e.g. a libcurl.dll built against static CRT). You can pass the necessary compiler/linker options via standard CMake options/envs. I discovered these issues while enabling test runs on AppVeyor CI with all supported MSVC version in various configurations, and `-DCURL_STATIC_CRT=ON` set. Symptoms of double CRT: - `curl -V` output with newline missing between 'Protocols:' and 'Features:' lines, then runtests unable to detect feature and emitting a Perl warning for uninitialized `$feat` variable. (due to parallel output buffering for `puts()` and `curl_mprintf()`) This is visible in master builds, e.g.: CM VS2019, Debug, x64, OpenSSL 3.0 + Schannel, Shared, !verbose, Build-tests: ``` WARNING: this libcurl is Debug-enabled, do not use in production curl 8.23.0-DEV (Windows) libcurl/8.23.0-DEV OpenSSL/3.0.18 (Schannel) WinLDAP Release-Date: [unreleased] Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt mqtts pop3 pop3s rtsp smtp smtps telnet tftp ws wssFeatures: alt-svc AsynchDNS Debug HSTS HTTPS-proxy HTTPSIG IPv6 Kerberos Largefile MultiSSL SPNEGO SSL SSPI threadsafe UnixSockets ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/54865570/job/urr2rgnr32hwllw2#L246 Notice the missing newline before `Features:`, and appearing above `WARNING:` instead. - test1622 failing. - 'Debug Assertion Failed! Expression: _acrt_first_block == header' crashed in both the app and the libcurl.dll it loaded. (possibly) Follow-up to 6140746 #16522 Follow-up to 049352d #16516 Follow-up to edfa537 #16456 #16394 Follow-up to 4fc6ebe #1621 Cherry-picked from #23306 Closes #23336

Merged this as separate PR, leaving this PR to keep the bumpy path it
took to explore the different directions it triggered. The size pre-fill
feature became the smaller one compared to the rest, but it was the one
initiating this PR.
w/o ws https://github.com/curl/curl/pull/16394/files?w=1
Good runs with pre-fill checks enabled:
https://ci.appveyor.com/project/curlorg/curl/builds/51546545
https://github.com/curl/curl/actions/runs/13419961486?pr=16394
runtests: support multi-target cmake, drop workarounds from CI #16452
windows: drop code and curl manifest targeting W2K and older #16453
cmake: hide empty
MINGW64_VERSIONoutput for mingw32ce #16455cmake: restrict static CRT builds to static curl exe, test in CI #16456
INSTALL-CMAKE.md: mention
ZLIB_USE_STATIC_LIBS#16457CI: misc improvements, restore VS2008 job #16458
build: drop unused
getparttool #16460cmake: pre-fill known type sizes for Windows OSes #16464