Skip to content

Build failure: Qt 5.9.8 compatibility issues with GCC 13/MinGW-w64 (numeric_limits and TOUCHINPUT) #1061

@alextodd1

Description

@alextodd1

Description: I encountered compilation failures while building the windows dependencies for Litecoin Core v0.21.4 using GCC 13.2.0 on WSL (Ubuntu 24.04).

The build fails in the qt dependency due to changes in GCC 13 headers (missing includes) and updated MinGW-w64 system headers (struct redefinitions).

Environment:

  • Litecoin Core Version: v0.21.4
  • OS: Windows 11 (WSL2 running Ubuntu 24.04)
  • Compiler: x86_64-w64-mingw32-g++ (GCC 13.3.0)
  • Host: x86_64-w64-mingw32

Steps to Reproduce:

  1. Install build dependencies on a modern Linux distro (e.g., Ubuntu 24.04) that defaults to GCC 13.
  2. Clone the repository and checkout v0.21.4.
  3. Navigate to cd depends.
  4. Attempt to build for Windows: make HOST=x86_64-w64-mingw32.

Issues Found:

  1. Missing include qbytearraymatcher.h attempts to use std::numeric_limits without explicitly including the header, which is required in GCC 11+.

Error Log:

qbytearraymatcher.h:103:38: error: ‘numeric_limits’ is not a member of ‘std’
const auto uchar_max = (std::numeric_limits<uchar>::max)();
  1. Redefinition of tagTOUCHINPUT qwindowsmousehandler.cpp defines struct tagTOUCHINPUT, which is already defined in the modern MinGW-w64 winuser.h system header included by Ubuntu 24.04.

Error Log:

qwindowsmousehandler.cpp:65:16: error: redefinition of ‘struct tagTOUCHINPUT’
/usr/share/mingw-w64/include/winuser.h:2773:18: note: previous definition of ‘struct tagTOUCHINPUT’

Workarounds / Quick Fixes:
I was able to complete the build by manually patching the files during the build process using the following sed commands:

Fix 1: Add missing include
sed -i '40i #include <limits>' /home/alext/litecoin/depends/work/build/x86_64-w64-mingw32/qt/5.9.8-6085c2b077c/qtbase/src/corelib/tools/qbytearraymatcher.h

Fix 2: Comment out struct redefinition
sed -i '65,76s/^/\/\//' /home/alext/litecoin/depends/work/build/x86_64-w64-mingw32/qt/5.9.8-6085c2b077c/qtbase/src/plugins/platforms/windows/qwindowsmousehandler.cpp

Suggested Fix:
Patches should be added to depends/patches/qt/ to ensure compatibility with GCC 13 and modern MinGW environments.

Metadata

Metadata

Assignees

No one assigned

    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