Opened 3 years ago

Closed 2 years ago

#17639 closed defect (fixed)

Version 3.0.2 fails to compile on OS X Sierra: request to backport fixes for mediactrl

Reported by: mojca Owned by:
Priority: normal Milestone: 3.0.3
Component: wxOSX Version: 3.0.2
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

In MacPorts we are packaging wxWidgets 3.0.2 for all available platforms (from 10.5 to 10.12). Unfortunately it no longer compiles on 10.12 due to some minor problems that have already been fixed in master in the meantime.

The first fix required is

http://trac.wxwidgets.org/changeset/f6a2d1caef5c6d412c84aa900cb0d3990b350938/git-wxWidgets

and I can easily apply that one.

The second problem is QTKit. In the master branch one can already use AV Foundation instead of QTKit, but I'm not confident enough in backporting the patch, so the only easy workaround for us is to disable mediactrl completely.

I would be grateful if the functional patches could be backported to a stable release (I can also fetch them from a 3.0 branch if needed).

See https://trac.macports.org/ticket/52069 for details.

Change History (11)

comment:1 Changed 3 years ago by Vadim Zeitlin <vadim@…>

In 817bd0076f61ed96694ec6cebba46ca5df495998/git-wxWidgets:

Don't include QuickTime headers unnecessarily

This should fix compilation under macOS Sierra (10.12).

See #17639.

(cherry picked from commit f6a2d1caef5c6d412c84aa900cb0d3990b350938)

comment:2 Changed 3 years ago by vadz

  • Status changed from new to infoneeded_new

Sorry, I'm not sure what needs to be done here. I've applied the fix you mentioned, but I don't know what else could/should be done, could you please explain which "functional patches" did you have in mind?

comment:3 Changed 3 years ago by mojca

  • Status changed from infoneeded_new to new

Once the patch you just backported is added, wxWidgets fails with:

../src/osx/cocoa/mediactrl.mm:52:10: fatal error: 'QTKit/QTKit.h' file not found
#include <QTKit/QTKit.h>
         ^

The master branch can switch between the deprecated QtKit and AV Foundation, but the branch 3.0 cannot.

A "workaround" is to--disable-mediactrl to allow wxWidgets to build at all, but that's just a temporary solution.

The relevant code from master is this:

#if wxUSE_MEDIACTRL
//...
#ifndef wxOSX_USE_QTKIT
    #if wxOSX_USE_IPHONE
        #define wxOSX_USE_QTKIT 0
        #define wxOSX_USE_AVFOUNDATION 1
    #else
        #define wxOSX_USE_QTKIT 1
        #define wxOSX_USE_AVFOUNDATION 0
    #endif
#else
    #if wxOSX_USE_QTKIT
        #define wxOSX_USE_AVFOUNDATION 0
    #else
        #define wxOSX_USE_AVFOUNDATION 1
    #endif
#endif

#if wxOSX_USE_AVFOUNDATION && wxOSX_USE_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
    #define wxOSX_USE_AVKIT 1
#else
    #define wxOSX_USE_AVKIT 0
#endif

//===========================================================================
//  BACKEND DECLARATIONS
//===========================================================================

#if wxOSX_USE_QTKIT
//...
#include <QTKit/QTKit.h>
//...
#endif
    
#if wxOSX_USE_AVFOUNDATION

#import <AVFoundation/AVFoundation.h>

#if wxOSX_USE_AVKIT 
#import <AVKit/AVKit.h>
#endif
// ...

In WX_3_0_BRANCH it's just:

#if wxUSE_MEDIACTRL

#include "wx/mediactrl.h"
// ...
#include <QTKit/QTKit.h>

and #include <QTKit/QTKit.h> cannot be honoured in 10.12, while master allows using another backend.

It might be enough to just copy src/osx/cocoa/mediactrl.mm from master to WX_3_0_BRANCH, I don't know. I would have to ask users of Sierra to help testing (or boot up my machine from USB stick containing 10.12, but that's awfully slow).

I don't know if switching to AVKIT is done automatically on Sierra. All my observations are based solely on reading the sources (and assuming that the one who added support for AVKIT to wxWidgets must have tested that on some recent version of OS X) and from getting confirmation of Sierra users that disabling that module helped.

comment:4 Changed 3 years ago by vadz

The simplest fix I see is to add a test to <QTKit/QTKit.h> to configure. If it fails, mediactrl would be disabled, thus fixing the build on 10.12, while still allowing to use it on older systems.

Could you please do and test this? TIA!

comment:5 Changed 3 years ago by vadz

  • Resolution set to port to stable
  • Status changed from new to portneeded

Done in dda1c7cfd4c353377d0e2a86d0a283f691cf672c in the trunk, please try backporting (and testing) this to 3.0. TIA!

comment:6 Changed 3 years ago by mojca

Seeing https://github.com/wxWidgets/wxWidgets/pull/337 I got the impression that support for < 10.9 has now been dropped from master?

Of course this doesn't prevent me from including just the relevant patches, I just don't quite understand the reasoning behind those other commits (it started with "we only support 10.7 and newer anyway" and then "so we can live with 10.9+ avkit only").

I was slightly hoping to get some configuration option to switch between the two rather than just testing, but if you decided to drop QTKit completely, this is a moot point anyway.

comment:7 Changed 3 years ago by vadz

No, it should still work on 10.7 (but testing it would be, of course, appreciated).

comment:8 Changed 3 years ago by mojca

This is just to confirm that master compiles on 10.7 as expected.

comment:9 Changed 3 years ago by TcT

Please see PR https://github.com/wxWidgets/wxWidgets/pull/341 which should fix the issue for 3.0 branch.

I've already tested it with 10.12 SDK, somebody should test it with older SDKs which still contain QTKit.

comment:10 Changed 3 years ago by Tobias Taschner <TcT2k@…>

In 4dad61831a1c377e2b1c77eefabad67606781254/git-wxWidgets:

Added --disable-qtkit to force usage of AVFoundation

See #17639

comment:11 Changed 2 years ago by vadz

  • Resolution changed from port to stable to fixed
  • Status changed from portneeded to closed

AFAICS this was fixed, so closing -- please reopen if I was wrong.

Note: See TracTickets for help on using tickets.