Repository navigation
Conversation
CURL_STATIC_CRT with shared libcurl when not building curl exeCURL_STATIC_CRT with shared libcurl and no curl exe
vszakats
added a commit
that referenced
this pull request
Mar 4, 2025
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
pps83
pushed a commit
to pps83/curl
that referenced
this pull request
Apr 26, 2025
pps83
pushed a commit
to pps83/curl
that referenced
this pull request
Apr 26, 2025
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
1 task done
vszakats
added a commit
that referenced
this pull request
Oct 16, 2026
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
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.
Follow-up to edfa537 #16456
Thinking that libcurl.dll users in general might find this combination
working (not crashing) and useful, depending on how they use libcurl.
CURL_STATIC_CRTwith UCRT VS2015+ builds #16522