Skip to content

Windows MinGW-w64 (Qt6, C++20) Support & Standalone EXE Build Guide #1485

@crazy-robotics

Description

@crazy-robotics

Description

I am trying to build RViz2 on Windows using:

  • Compiler: MinGW-w64 (GCC ≥ 11.2, C++20)
  • GUI Framework: Qt6
  • Goal: Generate a standalone .exe for distribution.

Currently, the official ROS 2 Windows support focuses on MSVC, and there is no clear documentation for MinGW-w64 builds. This makes it difficult for developers who prefer GCC-based toolchains on Windows.

Problem Details

  1. Missing MinGW Build Support

    • Many ROS 2 packages assume MSVC and require patches for MinGW.
    • Example issues:
      • console_bridge fails with MinGW due to dllexport differences.
      • OGRE plugins need manual adjustments.
  2. Qt6 Compatibility

    • The current CMakeLists.txt does not explicitly enforce Qt6 (defaults to Qt5 in some cases).
  3. Standalone EXE Packaging

    • No official guide on bundling:
      • Qt6 .dll files (via windeployqt)
      • MinGW runtime dependencies
      • OGRE plugins

Requested Changes

  1. Add MinGW Build Support

    • Provide MinGW-compatible patches for critical dependencies (console_bridge, rviz_ogre_vendor, etc.).
    • Document CMake flags for MinGW builds (-G "MinGW Makefiles").
  2. Qt6 Modernization

    • Update CMakeLists.txt to explicitly support Qt6 (while maintaining Qt5 backward compatibility).
  3. Standalone EXE Packaging Guide

    • Add a windows/README.md with steps to:
      • Use windeployqt for Qt dependencies.
      • Bundle MinGW runtime .dll files.
      • Handle OGRE plugin paths.

Example Workaround (Current Approach)

I managed to build RViz2 with MinGW by:

  1. Manually patching console_bridge.
  2. Forcing Qt6 in CMakeLists.txt:
    find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets OpenGL)  
  3. Using windeployqt for .dll bundling.

However, this process is fragile and undocumented.

Additional Context

  • Why MinGW?
    • Some developers prefer GCC toolchains for consistency with Linux.
    • MinGW builds may be smaller/faster than MSVC in some cases.
  • Why Qt6?
    • Qt5 is nearing EOL (2023), and Qt6 offers better performance.

Next Steps

  1. Can the maintainers officially support MinGW-w64 builds?
  2. Would a pull request (e.g., Qt6 modernization) be welcome?
  3. Is there interest in adding a Windows packaging guide?

I’m happy to contribute patches/documentation if this is deemed useful!


Labels (Suggested)

  • enhancement
  • windows
  • build system
  • documentation

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions