-
Notifications
You must be signed in to change notification settings - Fork 82
Windows: Qt Debug dlls conflict with CXX-Qt #1234
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
Comments
The solution for this is outlined here: rust-lang/rust#39016 (comment) We can include this in cxx-qt-cmake with something like this: target_link_options(<crate>-static INTERFACE /NODEFAULTLIB:msvcrt /DEFAULTLIB:msvcrtd) Open Question: In a pure Cargo build, do we also link to the debug dlls automatically? If so, we need to emit the right linker flags in the build script as well. |
Once KDAB/cxx-qt-cmake#12 is merged, this should no longer be necessary. Closes KDAB#1234
Once KDAB/cxx-qt-cmake#12 is merged, this should no longer be necessary. Closes KDAB#1234
Once KDAB/cxx-qt-cmake#12 is merged, this should no longer be necessary. Closes KDAB#1234
It turns out this unfortunately doesn't work as easily. The other approach would be to just always use the release runtime. set_target_properties(Qt6::Core PROPERTIES MAP_IMPORTED_CONFIG_DEBUG "RELEASE")
set_target_properties(Qt6::Quick PROPERTIES MAP_IMPORTED_CONFIG_DEBUG "RELEASE")
set_target_properties(Qt6::Gui PROPERTIES MAP_IMPORTED_CONFIG_DEBUG "RELEASE")
set_target_properties(Qt6::Qml PROPERTIES MAP_IMPORTED_CONFIG_DEBUG "RELEASE")
set_target_properties(Qt6::QuickControls2 PROPERTIES MAP_IMPORTED_CONFIG_DEBUG "RELEASE") Unfortunately this has to be done for all Qt packages that link into the final binary... |
On Windows, due to Rust always linking to the non-Debug runtime, Corrosion users need to do the same with all linked in C++ dependencies.
This includes Qt!
On Windows, Qt ships debug dlls that are built in debug mode and link to the debug runtime.
This is not compatible with CXX-Qt, and we must ensure that our users always link to the right Qt binaries (e.g. the non-Debug ones, even in a Debug build).
We may be able to fix this in cxx-qt-cmake for our users, otherwise we should emit a warning/error, like we do if you have set the incorrect MSVC runtime.
Otherwise, we may run into UB, as the debug and non-debug runtimes on Windows are not ABI-compatible!
Encountered by @narnaud in yesterdays training.
The text was updated successfully, but these errors were encountered: