Opened 3 years ago

Last modified 12 months ago

#62964 new enhancement

QT 5.9: Add Mavericks Compatibility

Reported by: Wowfunhappy (Jonathan) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.0
Keywords: haspatch mavericks Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), Wowfunhappy (Jonathan), mascguy (Christopher Nielsen)
Port: qt59

Description

It turns out that QT 5.9 is surprisingly easy to build on Mavericks. I just commented out a few functions, and away it went. Replacing qmacstyle_mac.mm with the version from QT 5.8 (plus a couple changes) made apps look pretty too!

This patch will allow qt59-qtbase and most of its submodules to build and run on Mavericks. I used this a few weekends ago to bulid Mavericks-compatible versions of several emulators which require QT 5.9, most notably Citra and Dolphin.

There is one thing I'm a bit stuck on. When I compile QT without using MacPorts (ie, by following https://wiki.qt.io/Building_Qt_5_from_Git#Installing_.28Linux_.2F_OS_X.29), QTTools builds without issue! In MacPorts, however, it fails:

Undefined symbols for architecture x86_64:
  "vtable for ApplicationEventFilter", referenced from:
      _main in main.o

I'd rather not disable the QTTools subport, since I know it should be able to work.

Anyway, up to you whether the patch is desirable to have in MacPorts, I just wanted to share it. Please let me know if there's anything I can fix up, as I've never done this before!

Attachments (10)

portfile.patch (1.4 KB) - added by Wowfunhappy (Jonathan) 3 years ago.
patch-mavericks-compatibility.diff (17.1 KB) - added by Wowfunhappy (Jonathan) 3 years ago.
patch-mavericks-aesthetics.diff (577.3 KB) - added by Wowfunhappy (Jonathan) 3 years ago.
Portfile.patch (2.0 KB) - added by Wowfunhappy (Jonathan) 3 years ago.
patch-qttools-skip-assistant.diff (584 bytes) - added by Wowfunhappy (Jonathan) 3 years ago.
patch-qoperatingsystemversion-109.diff (3.1 KB) - added by Wowfunhappy (Jonathan) 3 years ago.
patch-qcocoa-build-on-109.diff (6.4 KB) - added by Wowfunhappy (Jonathan) 3 years ago.
patch-backport-gui-109.diff (928 bytes) - added by Wowfunhappy (Jonathan) 3 years ago.
patch-backport-corelib-109.diff (1.8 KB) - added by Wowfunhappy (Jonathan) 3 years ago.
patch-firstObject-109.diff (641 bytes) - added by Wowfunhappy (Jonathan) 3 years ago.

Download all attachments as: .zip

Change History (21)

Changed 3 years ago by Wowfunhappy (Jonathan)

Attachment: portfile.patch added

Changed 3 years ago by Wowfunhappy (Jonathan)

Changed 3 years ago by Wowfunhappy (Jonathan)

comment:1 Changed 3 years ago by Wowfunhappy (Jonathan)

Type: defectenhancement

comment:2 Changed 3 years ago by Wowfunhappy (Jonathan)

Cc: Wowfunhappy added

comment:3 Changed 3 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:4 Changed 3 years ago by mascguy (Christopher Nielsen)

Marcus, I've only taken a cursory look, but this seems like it could be a worthwhile addition.

Your thoughts?

Changed 3 years ago by Wowfunhappy (Jonathan)

Attachment: Portfile.patch added

Changed 3 years ago by Wowfunhappy (Jonathan)

Changed 3 years ago by Wowfunhappy (Jonathan)

Changed 3 years ago by Wowfunhappy (Jonathan)

Changed 3 years ago by Wowfunhappy (Jonathan)

Attachment: patch-backport-gui-109.diff added

Changed 3 years ago by Wowfunhappy (Jonathan)

Changed 3 years ago by Wowfunhappy (Jonathan)

Attachment: patch-firstObject-109.diff added

comment:5 Changed 3 years ago by Wowfunhappy (Jonathan)

If there is still interest in this, please use the new set of files I've just attached.

What I didn't realize two weeks ago was that RJVB independently added Mavericks compatibility to QT 5.9 several years back, in his MacStrop repository of custom port files. We made many of the same changes, but RJVB made some edits I did not, and unlike me I'm pretty sure he actually knew what he was doing. Furthermore, his qmacstyle is based on the QT 5.9 version rather than the 5.8 version, so the diff count is reasonable and you can see what actually changed.

(This also means it's basically RJVB's work, I just pulled out the patches needed for Mavericks, since Macstrop contains many other more extensive edits!)

QTTools is still failing with the same error. The failure looks to be in Linguist, so the easy way out would be to just disable that piece... but again, the whole of QTTools builds fine outside of MacPorts, so it should be able to work.

comment:6 Changed 3 years ago by kencu (Ken)

Well, to have a chance of getting this in, qttools would have to work.

This bug report <https://bugreports.qt.io/browse/QTBUG-58341?gerritIssueStatus=All> looks somewhat similar to your error.

This is a weird helper message:

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.

and that error brought me here:

<https://stackoverflow.com/questions/31861803/a-missing-vtable-usually-means-the-first-non-inline-virtual-member-function-has>

But you say it builds outside MacPorts but not inside MacPorts? Then if that is the case, you're talking compiler selection, SDK being used, or something being picked up in ${prefix} usually.

comment:7 Changed 3 years ago by mascguy (Christopher Nielsen)

Cc: mascguy removed

comment:8 Changed 3 years ago by realnc (Nikos Chantziaras)

I'm not using macports for qt, but I found this while searching on whether qt 5.9 can be made to work on mavericks. I applied these patches (the newer ones, not the original ones) on top of Qt 5.9.9. I then built it on macOS 10.15 and 10.12. It builds fine, but the produced binaries either crash or produce garbled graphics when running on 10.9.

When running from the terminal, you see a lot of errors like this:

QCoreTextFontDatabase: Found no matching fonts for family ".Aqua Kana"
QCoreTextFontDatabase: Found no matching fonts for family ".Helvetica LT MM"
QCoreTextFontDatabase: Found no matching fonts for family ".Helvetica Neue Desk UI"
QCoreTextFontDatabase: Found no matching fonts for family ".Keyboard"
+[NSGraphicsContext graphicsContextWithCGContext:flipped:]: unrecognized selector sent to class 0x7fff7588e768
An uncaught exception was raised
+[NSGraphicsContext graphicsContextWithCGContext:flipped:]: unrecognized selector sent to class 0x7fff7588e768
2021-10-23 07:33:55.547 QTads[254:507] (
        0   CoreFoundation                      0x00007fff8c59a41c __exceptionPreprocess + 172
        1   libobjc.A.dylib                     0x00007fff9106be75 objc_exception_throw + 43
        2   CoreFoundation                      0x00007fff8c59d1ed +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
        3   CoreFoundation                      0x00007fff8c4f85b2 ___forwarding___ + 1010
        4   CoreFoundation                      0x00007fff8c4f8138 _CF_forwarding_prep_0 + 120
        5   QTads                               0x000000010735df08 _ZNK16QMacStylePrivate13drawFocusRingEP8QPainterRK5QRectiid + 1016
        6   QTads                               0x000000010736e28d _ZNK9QMacStyle11drawControlEN6QStyle14ControlElementEPK12QStyleOptionP8QPainterPK7QWidget + 20541
        7   QTads                               0x0000000106da109f _ZN12KColorButton10paintEventEP11QPaintEvent + 111
        8   QTads                               0x000000010706da62 _ZN7QWidget5eventEP6QEvent + 1106
        9   QTads                               0x00000001070344d9 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 265
        10  QTads                               0x0000000107035749 _ZN12QApplication6notifyEP7QObjectP6QEvent + 377
        11  QTads                               0x000000010791b986 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 166
        12  QTads                               0x0000000107066910 _ZN14QWidgetPrivate10drawWidgetEP12QPaintDeviceRK7QRegionRK6QPointiP8QPainterP19QWidgetBackingStore + 3184
        13  QTads                               0x00000001070670bf _ZN14QWidgetPrivate22paintSiblingsRecursiveEP12QPaintDeviceRK5QListIP7QObjectEiRK7QRegionRK6QPointiP8QPainterP19QWidgetBackingStore + 1071

I went back to qt 5.8 for targeting mavericks. So I just wanted to point out here that it seems to me that just because qt 5.9 can be built to target mavericks with these patches doesn't actually mean it runs fine on mavericks.

comment:9 Changed 3 years ago by Wowfunhappy (Jonathan)

The patches really do work for me, without any graphical glitches or errors such as that. I use them to build Dolphin and Citra on Mavericks. What are you building that experiences these errors?

Is it possible something changed since I made the patches?

Edit: Also, make sure you're not applying _both_ sets of patches, I"m not sure what that would do. I made one set early on and then a new set a month later.

Version 2, edited 3 years ago by Wowfunhappy (Jonathan) (previous) (next) (diff)

comment:10 Changed 2 years ago by Wowfunhappy (Jonathan)

I think I know why qttools doesn't build with MacPorts, but does build independently—I need to set the macOS SDK to 10.10 instead of 10.9. Will do some testing if I have time...

comment:11 Changed 12 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added
Note: See TracTickets for help on using tickets.