How to build Qt 5.6.1 on Sierra with Xcode 8.3?



  • Re: Static Install Fails on OSX

    I'm trying to build Qt 5.6.1 on Sierra with Xcode 8.3. I get the error referenced above. I tried copying in qtconnectivity from the 5.6.2 tag, same error. I tried the 5.7.1 tag, new error:

    In file included from /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/base/mac/mac_util.mm:23:
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/base/mac/sdk_forward_declarations.h:465:12: error: cannot define category for undefined class 'CBPeripheral'
    @interface CBPeripheral (MavericksSDK)
               ^
    

    What am I doing wrong?


  • Moderators

    @davidb said in How to build Qt 5.6.1 on Sierra with Xcode 8.3?:

    cannot define category for undefined class 'CBPeripheral'

    The problem is in XCode 8 and Chromium's code which QtWebEngine uses. Here is a fix for you:

    http://stackoverflow.com/questions/39572757/cannot-define-category-for-undefined-class



  • @ambershark Thanks - after applying that fix, I now get this set of errors:

    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm:46:16: error: unknown class name 'CBCentralManagerDelegate'; did you mean 'CBCentralManager'?
        : NSObject<CBCentralManagerDelegate> {
                   ^~~~~~~~~~~~~~~~~~~~~~~~
                   CBCentralManager
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/base/mac/sdk_forward_declarations.h:46:8: note: 'CBCentralManager' declared here
    @class CBCentralManager;
           ^
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm:46:16: error: type argument 'CBCentralManager' must be a pointer (requires a '*')
        : NSObject<CBCentralManagerDelegate> {
                   ^
                                            *
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm:46:7: error: type arguments cannot be applied to non-parameterized class 'NSObject'
        : NSObject<CBCentralManagerDelegate> {
          ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm:108:7: warning: multiple methods named 'state' found [-Wobjc-multiple-method-names]
      if ([manager_ state] != CBCentralManagerStatePoweredOn) {
          ^~~~~~~~~~~~~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:312:44: note: using
    @property (readonly) NSURLSessionTaskState state;
                                               ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:182:21: note: also found
    @property NSInteger state;
                        ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSButton.h:27:21: note: also found
    @property NSInteger state;
                        ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSMenuItem.h:106:21: note: also found
    @property NSInteger state;
                        ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSGestureRecognizer.h:67:47: note: also found
    @property (readonly) NSGestureRecognizerState state;
                                                  ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSDrawer.h:73:32: note: also found
    @property (readonly) NSInteger state;
                                   ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSVisualEffectView.h:99:31: note: also found
    @property NSVisualEffectState state;
                                  ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheral.h:126:39: note: also found
    @property(readonly) CBPeripheralState state;
                                          ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/ImageCaptureCore.framework/Headers/ICScannerFunctionalUnits.h:663:53: note: also found
    @property(readonly)   ICScannerFunctionalUnitState  state;
                                                        ^~~~~
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm:108:27: error: use of undeclared identifier 'CBCentralManagerStatePoweredOn'
      if ([manager_ state] != CBCentralManagerStatePoweredOn) {
                              ^
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm:125:13: warning: instance method '-scanForPeripheralsWithServices:options:' not found (return type defaults to 'id') [-Wobjc-method-access]
      [manager_ scanForPeripheralsWithServices:services options:nil];
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheral.h:16:8: note: receiver is instance of class declared here
    @class CBCentralManager;
           ^
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm:131:15: warning: instance method '-stopScan' not found (return type defaults to 'id') [-Wobjc-method-access]
        [manager_ stopScan];
                  ^~~~~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheral.h:16:8: note: receiver is instance of class declared here
    @class CBCentralManager;
           ^
    /Users/sierramcbuildmachine/dev/qt561_fmosoft/qtwebengine/src/3rdparty/chromium/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm:155:34: warning: instance method '-initWithDelegate:queue:' not found (return type defaults to 'id') [-Wobjc-method-access]
      manager_.reset([[aClass alloc] initWithDelegate:bridge_
                                     ^~~~~~~~~~~~~~~~~~~~~~~~
    4 warnings and 4 errors generated.
    [9242/11832] OBJCXX obj/src/3rdparty/chromium/device/bluetooth/device_bluetooth.bluetooth_l2cap_channel_mac.o
    ninja: build stopped: subcommand failed.
    make[4]: *** [invoke_ninja] Error 1
    make[3]: *** [sub-gyp_run-pro-make_first] Error 2
    make[2]: *** [sub-core-make_first] Error 2
    make[1]: *** [sub-src-make_first] Error 2
    make: *** [module-qtwebengine-make_first] Error 2
    
    

    Any ideas?


  • Moderators

    @davidb To be honest these problems look like more of the same related to the issue above.

    It's basically not having the specific header included to define these objects.

    Like #import <CoreBluetooth/CBPeripheral.h> for the fix above. I don't know obj-c so I can't help with the specific but if I had to guess you could try #import <CoreBluetooth/CBCentralManager.h> and #import <CoreBluetooth/CBCentralManagerDelegate.h>. Just guessing though. :)

    I would google that error and I bet you find someone who had similar problems and a possible solution.



  • @ambershark thanks. Here's the solution that works for me, in case it helps someone else:

    Start with Qt 5.6.1 on MacOS Sierra 10.12.3, with Xcode 8.3.

    1. following https://forum.qt.io/topic/72833/static-install-fails-on-osx, get qtconnectivity from Qt 5.7.1
    2. Similarly, get qtwebengine 5.7.1 and run git submodule update --init

    Then Qt 5.6.1 (with the two 5.7.1 modules) built for me.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.