compilation error in CoreFoundation - visionos

when trying to build wireshark I'm getting the following, any idea how to solve it?

[ 13%] Building C object wsutil/CMakeFiles/wsutil.dir/os_version_info.c.o
In file included from wireshark/wsutil/os_version_info.c:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:54:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:676:195: error: expected ','
  676 | void *CFAllocatorAllocateTyped(CFAllocatorRef allocator, CFIndex size, CFAllocatorTypeID descriptor, CFOptionFlags hint) API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0));
      |                                                                                                                                                                                                   ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:679:211: error: expected ','
  679 | void *CFAllocatorReallocateTyped(CFAllocatorRef allocator, void *ptr, CFIndex newsize, CFAllocatorTypeID descriptor, CFOptionFlags hint) API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0));
      |                                                                                                                                                                                                                   ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:682:165: error: expected ','
  682 | void *CFAllocatorAllocateBytes(CFAllocatorRef allocator, CFIndex size, CFOptionFlags hint) API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0));
      |                                                                                                                                                                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:685:181: error: expected ','
  685 | void *CFAllocatorReallocateBytes(CFAllocatorRef allocator, void *ptr, CFIndex newsize, CFOptionFlags hint) API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0));
      |                                                                                                                                                                                     ^
In file included from wireshark/wsutil/os_version_info.c:23:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:73:
/Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumberFormatter.h:144:147: error: expected ','
  144 | CF_EXPORT const CFNumberFormatterKey kCFNumberFormatterMinGroupingDigits API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0));    // CFNumber
      |                                                                                                                                                   ^
5 errors generated.
make[2]: *** [wsutil/CMakeFiles/wsutil.dir/os_version_info.c.o] Error 1
make[1]: *** [wsutil/CMakeFiles/wsutil.dir/all] Error 2
make: *** [all] Error 2
Answered by DTS Engineer in 814408022

The paths in those errors indicate you’re using the macOS 15.0 SDK. That SDK comes with Xcode 16, and the Xcode 16 command-line tools, which is aware of visionOS. So something weird is happening with your build system.

It’s hard to know what that might be because I don’t maintain expertise in third-party tooling. However, I can recommend that you run some basic tests, just to make sure that the Apple side of this is working as expected.

To start, run the test in the Run a Simple Test section of Investigating Third-Party IDE Integration Problems. Does that work?

If so, do this:

  1. Rewrite hello.c to use CF:

    #include <stdio.h>
    
    #include <CoreFoundation/CoreFoundation.h>
    
    int main(int argc, char ** argv) {
        CFShow(CFSTR("Hello Cruel World!"));
        return 0;
    }
    
  2. Add -framework CoreFoundation to the end of the clang invocation:

    % clang -o hello hello.c -framework CoreFoundation
    

Does that build? And run?

If it does, your Apple tools seem to be working correctly and you’ll need to investigate this from the perspective of the third-party tools and code you’re using.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

The paths in those errors indicate you’re using the macOS 15.0 SDK. That SDK comes with Xcode 16, and the Xcode 16 command-line tools, which is aware of visionOS. So something weird is happening with your build system.

It’s hard to know what that might be because I don’t maintain expertise in third-party tooling. However, I can recommend that you run some basic tests, just to make sure that the Apple side of this is working as expected.

To start, run the test in the Run a Simple Test section of Investigating Third-Party IDE Integration Problems. Does that work?

If so, do this:

  1. Rewrite hello.c to use CF:

    #include <stdio.h>
    
    #include <CoreFoundation/CoreFoundation.h>
    
    int main(int argc, char ** argv) {
        CFShow(CFSTR("Hello Cruel World!"));
        return 0;
    }
    
  2. Add -framework CoreFoundation to the end of the clang invocation:

    % clang -o hello hello.c -framework CoreFoundation
    

Does that build? And run?

If it does, your Apple tools seem to be working correctly and you’ll need to investigate this from the perspective of the third-party tools and code you’re using.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

compilation error in CoreFoundation - visionos
 
 
Q