Skip to content

Add support for the debug runtime in MSVC builds. #12

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

Merged
merged 1 commit into from
Apr 11, 2025

Conversation

LeonMatthesKDAB
Copy link
Collaborator

We can force the linker to choose the debug runtime, which is necessary
to override rusts libc, which by default wants to link to the release
runtime, even in debug mode.

With this patch CMake will override this behavior and use the debug
runtime if appropriate.
This is very important, as all parts of the program must agree on the runtime!
As Qt in Debug mode uses the debug runtime in their DLLs, we may
encounter undefined behavior otherwise.

We can force the linker to choose the debug runtime, which is necessary
to override rusts libc, which by default wants to link to the release
runtime, even in debug mode.

With this patch CMake will override this behavior and use the debug
runtime if appropriate.
This is very important, as all parts of the program must agree on the runtime!
As Qt in Debug mode uses the debug runtime in their DLLs, we may
encounter undefined behavior otherwise.
LeonMatthesKDAB added a commit to LeonMatthesKDAB/cxx-qt that referenced this pull request Apr 10, 2025
Once KDAB/cxx-qt-cmake#12 is merged, this should
no longer be necessary.

Closes KDAB#1234
LeonMatthesKDAB added a commit to LeonMatthesKDAB/cxx-qt that referenced this pull request Apr 10, 2025
Once KDAB/cxx-qt-cmake#12 is merged, this should
no longer be necessary.

Closes KDAB#1234
LeonMatthesKDAB added a commit to LeonMatthesKDAB/cxx-qt that referenced this pull request Apr 10, 2025
Once KDAB/cxx-qt-cmake#12 is merged, this should
no longer be necessary.

Closes KDAB#1234
@ahayzen-kdab ahayzen-kdab added the backport-candidate Change which could be backported to the stable series label Apr 11, 2025
Copy link
Collaborator

@ahayzen-kdab ahayzen-kdab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :-)

@LeonMatthesKDAB LeonMatthesKDAB merged commit 0f25fd0 into main Apr 11, 2025
2 checks passed
@LeonMatthesKDAB LeonMatthesKDAB deleted the msvc-debug-runtime branch April 11, 2025 12:27
@LeonMatthesKDAB LeonMatthesKDAB mentioned this pull request Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-candidate Change which could be backported to the stable series
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants