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

Error out when we detect incompatibilities between mingw and msvc #304

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

ogoffart
Copy link
Member

@ogoffart ogoffart commented Nov 2, 2023

This has caused lots of frustrations: eg:
slint-ui/slint#3802
slint-ui/slint#3539
slint-ui/slint#3739

Comment on lines +216 to +220
let spec = qmake_query("QMAKE_SPEC");
if (spec.contains("msvc") && cargo_target_env == "gnu")
|| (spec.contains("g++") && cargo_target_env == "msvc")
{
report_error(&format!("Rust target '{}' is not compatible with Qt mkspec '{spec}'. Mixing MinGW and MSVC is not allowed.", std::env::var_os("TARGET").unwrap_or_default().to_string_lossy()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want to make it even more useful to users, I suggest to split this into two if statements, each of which can report in report_error() what the user can do as remedy, i.e. if spec is mdvc but cargo target env is "gnu": "To fix this, please install Qt compiled for MinGW", and for the other one "To fix this, please install Qt for MSVC".

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe this is sufficiently clear. They could either solve it by installing a different version of Qt, or getting another build of rust.

(Note that rust users of Slint won't see this error anyway as the warning from the build.rs are hidden.)

@ogoffart ogoffart merged commit 0511506 into master Nov 2, 2023
19 checks passed
@ogoffart ogoffart deleted the detect-mingw-msvc-mix branch November 2, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants