Need help from Darwin users: Syntax errors in `.../Library/Frameworks/Foundation.framework/Headers`?

I’m trying to make a package build on Darwin at musescore: 4.0.2 -> 4.1.0 by doronbehar · Pull Request #243298 · NixOS/nixpkgs · GitHub and I encounter these weird syntax issues in ofborg:

In file included from /nix/store/yjj6klsa9sk1yq6dzmpd4snrr3dmbcfn-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:16:
/nix/store/yjj6klsa9sk1yq6dzmpd4snrr3dmbcfn-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1189:83: error: expected ','
    kCFURLBookmarkCreationWithSecurityScope API_AVAILABLE(macos(10.7), macCatalyst(13.0))  API_UNAVAILABLE(ios, watchos, tvos) = ( 1UL << 11 ), // Mac OS X 10.7.3 and later, include information in the bookmark data which allows the same sandboxed process to access the resource after being relaunched
                                                                                  ^
/nix/store/yjj6klsa9sk1yq6dzmpd4snrr3dmbcfn-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1190:98: error: expected ','
    kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess API_AVAILABLE(macos(10.7), macCatalyst(13.0)) API_UNAVAILABLE(ios, watchos, tvos) = ( 1UL << 12 ), // Mac OS X 10.7.3 and later, if used with kCFURLBookmarkCreationWithSecurityScope, at resolution time only read access to the resource will be granted
                                                                                                 ^
/nix/store/yjj6klsa9sk1yq6dzmpd4snrr3dmbcfn-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1200:85: error: expected ','
    kCFURLBookmarkResolutionWithSecurityScope API_AVAILABLE(macos(10.7), macCatalyst(13.0)) API_UNAVAILABLE(ios, watchos, tvos) = ( 1UL << 10 ), // Mac OS X 10.7.3 and later, use the secure information included at creation time to provide the ability to access the resource in a sandboxed process.
                                                                                    ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSArray.h:9:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSOrderedCollectionDifference.h:7:
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSOrderedCollectionChange.h:51:11: error: expected ';' after method prototype
- (id)init API_UNAVAILABLE(macos, ios, watchos, tvos);
          ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12:
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:156:21: error: expected ';' after method prototype
- (instancetype)init API_UNAVAILABLE(macos, ios, watchos, tvos);
                    ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:14:
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSCalendar.h:115:21: error: expected ';' after method prototype
- (instancetype)init API_UNAVAILABLE(macos, ios, watchos, tvos);
                    ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:26:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSMeasurement.h:8:
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSUnit.h:96:21: error: expected ';' after method prototype
- (instancetype)init API_UNAVAILABLE(macos, ios, watchos, tvos);
                    ^
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSUnit.h:97:20: error: expected ';' after method prototype
+ (instancetype)new API_UNAVAILABLE(macos, ios, watchos, tvos);
                   ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:26:
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSMeasurement.h:22:21: error: expected ';' after method prototype
- (instancetype)init API_UNAVAILABLE(macos, ios, watchos, tvos);
                    ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:27:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSMeasurementFormatter.h:11:
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSLocale.h:89:21: error: expected ';' after method prototype
- (instancetype)init API_UNAVAILABLE(macos, ios, watchos, tvos);     /* do not invoke; not a valid initializer for this class */
                    ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:39:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:11:
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURL.h:395:82: error: expected ','
    NSURLBookmarkCreationWithSecurityScope API_AVAILABLE(macos(10.7), macCatalyst(13.0)) API_UNAVAILABLE(ios, watchos, tvos) = ( 1 << 11 ), /* include information in the bookmark data which allows the same sandboxed process to access the resource after being relaunched */
                                                                                 ^
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURL.h:396:97: error: expected ','
    NSURLBookmarkCreationSecurityScopeAllowOnlyReadAccess API_AVAILABLE(macos(10.7), macCatalyst(13.0)) API_UNAVAILABLE(ios, watchos, tvos) = ( 1 << 12 ), /* if used with kCFURLBookmarkCreationWithSecurityScope, at resolution time only read access to the resource will be granted */
                                                                                                ^
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURL.h:402:84: error: expected ','
    NSURLBookmarkResolutionWithSecurityScope API_AVAILABLE(macos(10.7), macCatalyst(13.0)) API_UNAVAILABLE(ios, watchos, tvos) = ( 1 << 10 ) /* use the secure information included at creation time to provide the ability to access the resource in a sandboxed process */
                                                                                   ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:69:
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSProxy.h:28:28: error: expected ';' after method prototype
- (BOOL)allowsWeakReference API_UNAVAILABLE(macos, ios, watchos, tvos);
                           ^
/nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSProxy.h:29:28: error: expected ';' after method prototype
- (BOOL)retainWeakReference API_UNAVAILABLE(macos, ios, watchos, tvos);
                           ^
In file included from /tmp/nix-build-musescore-4.1.0.drv-0/source/src/framework/global/internal/platform/macos/macosinteractivehelper.mm:26:
In file included from /nix/store/z1h7s3bvqg65y9m0nwhx02gjw92ggmz0-apple-framework-Cocoa-11.0.0/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/Foundation.h:87:
In file included from /nix/store/g9q6d6p98w0gd9ymv60kawm15kg24fym-apple-framework-Foundation-11.0.0/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:9:
In file included from /nix/store/5c3545spggcjv0wv6sjnbjznymqp0b5y-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/Security.h:27:
/nix/store/5c3545spggcjv0wv6sjnbjznymqp0b5y-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecBase.h:142:73: error: expected ';' after top level declarator
typedef struct CF_BRIDGED_TYPE(id) __SecKeychainItem *SecKeychainItemRef API_UNAVAILABLE(ios, watchos, tvos, macCatalyst);
                                                                        ^
/nix/store/5c3545spggcjv0wv6sjnbjznymqp0b5y-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecBase.h:148:77: error: expected ';' after top level declarator
typedef struct CF_BRIDGED_TYPE(id) __SecKeychainSearch *SecKeychainSearchRef API_UNAVAILABLE(ios, watchos, tvos, macCatalyst);
                                                                            ^
/nix/store/5c3545spggcjv0wv6sjnbjznymqp0b5y-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecBase.h:154:35: error: expected ';' after top level declarator
typedef OSType SecKeychainAttrType API_UNAVAILABLE(ios, watchos, tvos, macCatalyst);
                                  ^
/nix/store/5c3545spggcjv0wv6sjnbjznymqp0b5y-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecBase.h:163:27: error: expected ')'
struct API_UNAVAILABLE(ios, watchos, tvos, macCatalyst) SecKeychainAttribute
                          ^
/nix/store/5c3545spggcjv0wv6sjnbjznymqp0b5y-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecBase.h:163:8: note: to match this '('
struct API_UNAVAILABLE(ios, watchos, tvos, macCatalyst) SecKeychainAttribute
       ^
/nix/store/vw0zbvb4n6c1mwfj5x4ggngqlkfgb070-Libsystem-1238.60.2/include/os/availability.h:9:132: note: expanded from macro 'API_UNAVAILABLE'
  #define API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__, __API_UNAVAILABLE3, __API_UNAVAILABLE2, __API_UNAVAILABLE1)(__VA_ARGS__)
                                                                                                                                   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Do all Darwin users experience these errors right now? This is very weird to me.

1 Like

Those errors happen when headers are mixed between different SDK versions. It looks like one of your dependencies (portaudio) is propagating Dariwn frameworks from the 10.12 SDK even though Qt is having you build against the 11.0 one.

On Darwin (at least x86_64-darwin), try rebuilding portaudio against the 11.0 SDK. Something like:

let
  # portaudio propagates Darwin frameworks. Rebuild it using the 11.0 stdenv from Qt and the 11.0 SDK frameworks.
  portaudio' = if !stdenv.isDarwin
    then portaudio
    else portaudio.override {
      inherit stdenv;
      inherit (darwin.apple_sdk_11_0.frameworks) AudioUnit AudioToolbox CoreAudio CoreServices Carbon;
    };
in
# ... (use `portaudio'` in your `buildInputs`
2 Likes