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

Disable WebEngine example on Windows + MinGW #167

Closed
ratijas opened this issue Jul 3, 2021 · 1 comment · Fixed by #175
Closed

Disable WebEngine example on Windows + MinGW #167

ratijas opened this issue Jul 3, 2021 · 1 comment · Fixed by #175
Labels
A-cross Area: Cross compilation C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows-gnu Toolchain: GNU, Operating system: Windows

Comments

@ratijas
Copy link
Collaborator

ratijas commented Jul 3, 2021

Summary

Qt does not ship pre-built WebEngine component for Windows MinGW target, so we should find a way to exclude it from the list of default targets on that platform's target triple.

Description

Running simple cargo build in qmetaobject-rs repository on Windows with MinGW environment results in build failure:

   Compiling qmetaobject v0.2.2 (C:\Users\ratijas\projects\qmetaobject-rs\qmetaobject)
   Compiling graph v0.1.0 (C:\Users\ratijas\projects\qmetaobject-rs\examples\graph)
The following warnings were emitted during compilation:

warning: src\webengine.rs:4:10: fatal error: QtWebEngine/QtWebEngine: No such file or directory
warning:  #include <QtWebEngine/QtWebEngine>
warning:           ^~~~~~~~~~~~~~~~~~~~~~~~~
warning: compilation terminated.

error: failed to run custom build command for `qmetaobject v0.2.2 (C:\Users\ratijas\projects\qmetaobject-rs\qmetaobject)`

Caused by:
  process didn't exit successfully: `C:\Users\ratijas\projects\qmetaobject-rs\target\debug\build\qmetaobject-4c86368b25d7a0a5\build-script-build` (exit code: 1)
  --- stdout
  TARGET = Some("i686-pc-windows-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-pc-windows-gnu")
[...]
  running: "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m32" "-I" "C:\\Users\\ratijas\\projects\\qmetaobject-rs\\qmetaobject" "-I" "C:/Qt/5.15.2/mingw81_32/include" "-Wall" "-Wextra" "-std=c++11" "-o" "C:\\Users\\ratijas\\projects\\qmetaobject-rs\\target\\i686-pc-windows-gnu\\debug\\build\\qmetaobject-54d9dbd8cb0dbb47\\out\\rust_cpp\\cpp_closures.o" "-c" "C:\\Users\\ratijas\\projects\\qmetaobject-rs\\target\\i686-pc-windows-gnu\\debug\\build\\qmetaobject-54d9dbd8cb0dbb47\\out\\rust_cpp\\cpp_closures.cpp"
  cargo:warning=src\webengine.rs:4:10: fatal error: QtWebEngine/QtWebEngine: No such file or directory
  cargo:warning= #include <QtWebEngine/QtWebEngine>
  cargo:warning=          ^~~~~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=compilation terminated.
  exit code: 1

Workaround

Manually specify packages to exclude from workspace builds:

cargo build --workspace --exclude webengine

Solution

I don't think politely asking Qt to ship pre-built WebEngine for MinGW is a viable solution, so let's try to mitigate the issue with Rust tools.

Cargo supports workspace-level package selection via default-members key. Cons:

  • Disables package for all platforms and targets;
  • Requires typing in every package twice, except excluded ones. You might think that there's an exclude key for this task, but turns out it's for something else — preventing directories entirely from even being scanned by cargo.

Anyway, I tried with Cargo.toml and .cargo/config.toml, and none of that works with triple-specific sections.

@ratijas ratijas added A-cross Area: Cross compilation C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows-gnu Toolchain: GNU, Operating system: Windows labels Jul 3, 2021
@jwintz
Copy link

jwintz commented Jul 3, 2021 via email

ratijas added a commit to ratijas/qmetaobject-rs that referenced this issue Jul 10, 2021
ratijas added a commit to ratijas/qmetaobject-rs that referenced this issue Jul 10, 2021
ratijas added a commit to ratijas/qmetaobject-rs that referenced this issue Jul 10, 2021
ratijas added a commit to ratijas/qmetaobject-rs that referenced this issue Jul 13, 2021
ratijas added a commit to ratijas/qmetaobject-rs that referenced this issue Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cross Area: Cross compilation C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows-gnu Toolchain: GNU, Operating system: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants