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

cmake: allow CURL_STATIC_CRT with UCRT VS2015+ builds #16522

Closed
wants to merge 10 commits into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Feb 28, 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

@vszakats vszakats added cmake Windows Windows-specific labels Feb 28, 2025
@vszakats vszakats changed the title [TEST] cmake: further CURL_STATIC_CRT patch and test (UCRT) [TEST] cmake: CURL_STATIC_CRT patch and test (UCRT) Feb 28, 2025
@github-actions github-actions bot added the CI Continuous Integration label Feb 28, 2025
@vszakats
Copy link
Member Author

vszakats commented Feb 28, 2025

The crasher printf() is before stderr init, I wonder if there is any way
that it touches stderr internally somehow anyway?

Here's the reproducer PR and CI VS2017 job:
#16522
https://ci.appveyor.com/project/curlorg/curl/builds/51605732/job/12n581uytend97mx
it's a hung job due to the GUI popup.

OK:

Hang:

So far it seems in crashes on these conditions:

  • curl's printf() before stderr init. (CRT printf() OK: https://ci.appveyor.com/project/curlorg/curl/builds/51606047)
  • --config Debug (or other Debug variants presumably) (meaning a Debug CRT)
  • CURL_STATIC_CRT=ON
  • ENABLE_DEBUG=ON (regardless of CURLDEBUG aka MemTrack)
  • VS2017 or VS2022. (VS2019 seems fine)

It's very odd.

Seeing these it seems slighly more likely that curl's printf() might be touching stderr
in debug builds. Pure guessing based on the alignments above.

@vszakats vszakats changed the title [TEST] cmake: CURL_STATIC_CRT patch and test (UCRT) [TEST] cmake: CURL_STATIC_CRT with UCRT Feb 28, 2025
@github-actions github-actions bot added the build label Feb 28, 2025
@vszakats vszakats changed the title [TEST] cmake: CURL_STATIC_CRT with UCRT cmake: allow CURL_STATIC_CRT with UCRT (VS2015+) builds Feb 28, 2025
@vszakats vszakats changed the title cmake: allow CURL_STATIC_CRT with UCRT (VS2015+) builds cmake: allow CURL_STATIC_CRT with UCRT (VS2015+) builds Feb 28, 2025
@vszakats vszakats changed the title cmake: allow CURL_STATIC_CRT with UCRT (VS2015+) builds cmake: allow CURL_STATIC_CRT with all UCRT (VS2015+) builds Feb 28, 2025
@vszakats vszakats changed the title cmake: allow CURL_STATIC_CRT with all UCRT (VS2015+) builds cmake: allow CURL_STATIC_CRT with UCRT VS2015+ builds Feb 28, 2025
@vszakats vszakats closed this in 6140746 Mar 4, 2025
@vszakats vszakats deleted the cm-stacrt-3 branch March 4, 2025 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build CI Continuous Integration cmake cmdline tool Windows Windows-specific
Development

Successfully merging this pull request may close these issues.

1 participant