Skip to content

macOS upgrade causes some build breakages #2189

Open

Description

@meteorcloudy

We recently updated macOS to 15.3.1 and Xcode 16.1 for all macOS VMs on Bazel CI.

https://buildkite.com/bazel/rules-apple-darwin/builds/10138#01958280-cdc9-4e72-85bb-7399fcdcc056

(01:03:28) ERROR: /Users/buildkite/builds/bk-macos-arm64-nn86/bazel/rules-apple-darwin/test/starlark_tests/targets_under_test/ios/BUILD:129:16: AssetCatalogCompile test/starlark_tests/targets_under_test/ios/app-intermediates/bundle_library_ios.bundle/xcassets failed: (Exit 1): xctoolrunner failed: error executing AssetCatalogCompile command (from target //test/starlark_tests/targets_under_test/ios:app)
  (cd /private/var/tmp/_bazel_buildkite/3ebd711cd99f106e0bfcf0a4dddc286c/execroot/_main && \
  exec env - \
    APPLE_SDK_PLATFORM=iPhoneSimulator \
    APPLE_SDK_VERSION_OVERRIDE=18.2 \
    PATH=/Users/buildkite/Library/Caches/bazelisk/downloads/sha256/ac72ad67f7a8c6b18bf605d8602425182b417de4369715bf89146daf62f7ae48/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin \
    XCODE_VERSION_OVERRIDE=16.2.0.16C5032a \
  bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/tools/xctoolrunner/xctoolrunner actool --compile '[ABSOLUTE]bazel-out/ios_sim_arm64-fastbuild-ios-sim_arm64-min12.0-applebin_ios-ST-26d4f6b9029b/bin/test/starlark_tests/targets_under_test/ios/app-intermediates/bundle_library_ios.bundle/xcassets' --platform iphonesimulator --minimum-deployment-target 12.0 --compress-pngs --target-device iphone '[ABSOLUTE]test/starlark_tests/resources/assets.xcassets')
# Configuration: 8931e66e98dfc14da7a42f9369975f695461c8159360912aca94c6ca1a76bc52
# Execution platform: @@platforms//host:host
/Users/buildkite/builds/bk-macos-arm64-nn86/bazel/rules-apple-darwin/test/starlark_tests/resources/assets.xcassets: error: No simulator runtime version from [<DVTBuildVersion 21F79>, <DVTBuildVersion 22D8075>] available to use with iphonesimulator SDK version <DVTBuildVersion 22C146>

Activity

  1. meteorcloudy commented on Mar 11, 2025

    @meteorcloudy
    MemberAuthor
  2. fweikert commented on Mar 11, 2025

    @fweikert
    Member

    The tests request Xcode 15.4, which is no longer installed on our MacOS workers. That's why CI bumps the version ("Fixed Xcode version: 15.4 -> 16.2..."), which might cause the problem. @brentleyjones is there something we need to do here, or is it a fix in rules_apple?

  3. brentleyjones commented on Mar 11, 2025

    @brentleyjones

    Even if using Xcode 16.2, we have the simulator runtime issue. @aaronsky has some experience with that and can give more context.

  4. aaronsky commented on Mar 11, 2025

    @aaronsky

    For the period we're using Xcode 16.2 on the CI nodes, xcodebuild -downloadPlatform iOS will install the iOS 18.3.1 simulator runtime by default, rather than the originally distributed iOS 18.2. The rules expect by default that the SDK version (18.2) match the simulator runtime version (now 18.3, represented sometimes as 18.3.1). The best thing to do in the short term would be to add a line like this somewhere in the VM/image setup:

    # ...
    # somewhere after running `xcodebuild -runFirstLaunch` and `xcodebuild -downloadPlatform iOS`
    
    xcode_short_version="$(xcodebuild -version | head -n1 | cut -d' ' -f2 | cut -d. -f1,2)"
    if [ "$xcode_short_version" = "16.2" ]; then
        xcodebuild -downloadPlatform iOS -buildVersion 18.2
    fi
    
    # ...
    # xcodebuild -checkFirstLaunchStatus

    This was the best workaround I could find in my own environment to make Bazel, simulator_creator.py, and xcodebuild happy. I wouldn't recommend running this on every CI job, as -downloadPlatform is very slow and needs some time to finish mounting the simulator runtime disk image after it's been installed.

  5. meteorcloudy commented on Mar 12, 2025

    @meteorcloudy
    MemberAuthor

    @aaronsky Where is this code? Can we fix the code to not make the assumption?

  6. aaronsky commented on Mar 12, 2025

    @aaronsky

    The code where this all breaks down is in these spots:

    When I examined this a couple weeks ago I couldn't figure out another sensible default that could be used to replace the assumption without requiring a new field or some new functionality in xcode_version. Making os_version required on the test runner would break building across different Xcode versions.

  7. meteorcloudy commented on Mar 12, 2025

    @meteorcloudy
    MemberAuthor

    I'm mostly worried that the next time we upgrade macOS this will happen again, is there a long term solution for this you have in mind?

  8. aaronsky commented on Mar 12, 2025

    @aaronsky

    That's a reasonable concern, and no, I don't have a long-term plan in the event Apple drops a new runtime on us out of the blue again. I agree it needs a more robust solution beyond this workaround.

  9. meteorcloudy commented on Mar 17, 2025

    @meteorcloudy
    MemberAuthor

    We added

    xcode_short_version="$(xcodebuild -version | head -n1 | cut -d' ' -f2 | cut -d. -f1,2)"
    if [ "$xcode_short_version" = "16.2" ]; then
        xcodebuild -downloadPlatform iOS -buildVersion 18.2
    fi
    

    to our setup script and updated the VMs, can you please verify if it works now?

  10. meteorcloudy commented on Mar 19, 2025

    @meteorcloudy
    MemberAuthor

    Looks like rules_apple is still red: https://buildkite.com/bazel/rules-apple-darwin/builds/10157

    @aaronsky Can you try to fix this from rules_apple side? I don't know what else we could do on the infra side and building and deploying a new VIM image is not very trivial.

  11. aaronsky commented on Mar 20, 2025

    @aaronsky

    There seems to still be a mismatch related to the installed simulator runtimes, but this time with the visionOS runtime. Which, as far as I'm aware, haven't received an update recently. I don't recognize runtime 22N895, but 21O5565d is the SDK that shipped alongside Xcode 15.4, and 22N799 is the SDK in Xcode 16.2.

  12. meteorcloudy commented on Mar 27, 2025

    @meteorcloudy
    MemberAuthor

    @aaronsky I believe this has to be fixed from rules_apple side, so I'm closing this now.

  13. aaronsky commented on Mar 29, 2025

    @aaronsky

    @meteorcloudy while I work on this from the rules_apple side, there is at least one other thing I need done on the macOS image (if you wouldn't mind reopening this issue). It appears as though the xros1.2 simulator runtime is still installed on the image, and it's confusing Xcode. Can we please see about removing the xros1.2 runtime and keeping xros2.2?

    Alternatively, we could use xcrun simctl runtime match set to forcefully map SDKs to simulator runtimes. But neither of these two things are things we can do from rules_apple on bazelci.

  14. 25 remaining items

  15. keith commented on Apr 24, 2025

    @keith
    Member

    @keith I think those setup commands are doing something weird and is causing bazel info to be very slow: buildkite.com/bazel/rules-apple-darwin/builds/10338#01966745-2306-4536-947b-88d6f13a6762, I'm not seeing such problem in other pipelines.

    if so I would think it would be from background process since bazel info definitely doesn't care about the state of those things. but since we found that the commands are also somewhat persistent I'm surprised it would affect things much. we can either move them to the VM setup or upgrade to 16.3 and delete them

  16. meteorcloudy commented on Apr 25, 2025

    @meteorcloudy
    MemberAuthor

    Looks like the postsubmit at least became more stable after bazelbuild/rules_apple#2701

    Presubmit still timing out...

    Let try upgrading Xcode to 16.3 first.

  17. fweikert commented on Apr 28, 2025

    @fweikert
    Member

    We're currently deploying new Silicon workers with MacOS 15.4.1 and Xcode 16.3.

  18. UebelAndre commented on Apr 28, 2025

    @UebelAndre
    Contributor

    We're currently deploying new Silicon workers with MacOS 15.4.1 and Xcode 16.3.

    I think this is failing a build in rules_rust:

    @fweikert can you take a quick look?

  19. fweikert commented on Apr 28, 2025

    @fweikert
    Member

    @UebelAndre based on other reports this seems to be a problem with zlib (example patch: https://www.mail-archive.com/[email protected]/msg860049.html). The version used by the examples is quite old (1.2.11 from 2017)

  20. fweikert commented on Apr 28, 2025

    @fweikert
    Member
  21. keith commented on Apr 28, 2025

    @keith
    Member

    i think on the rules_apple one you'll want to add the logging part of my shell_commands back just to make sure the platform defaults look good, seems to be a similar issue to the original one here

  22. UebelAndre commented on Apr 28, 2025

    @UebelAndre
    Contributor

    @UebelAndre based on other reports this seems to be a problem with zlib (example patch: https://www.mail-archive.com/[email protected]/msg860049.html). The version used by the examples is quite old (1.2.11 from 2017)

    Upgrading did indeed fix the issue, thanks!

  23. fweikert commented on Apr 29, 2025

    @fweikert
    Member
    % xcrun simctl runtime list
    --
      | == Disk Images ==
      | -- iOS --
      | iOS 18.2 (22C150) - 96A4751F-85DB-488A-84B3-1A170FBC42C0 (Ready)
      | iOS 18.4 (22E238) - C258D92D-B2F5-4AAB-B02C-767CE9078C82 (Ready)
      | iOS 18.3.1 (22D8075) - F16F5A25-A69F-4F0C-9FE9-EE8A7AA1FD51 (Ready)
      | -- tvOS --
      | tvOS 18.4 (22L254) - A768DFA7-53DB-40DA-A31F-AFB0920AF6D3 (Ready)
      | tvOS 18.2 (22K154) - B396A177-CD28-437C-A68A-4F410B0AFD5D (Ready)
      | -- watchOS --
      | watchOS 11.4 (22T250) - F2764383-628F-4E94-807F-8FF00737429A (Ready)
      | watchOS 11.2 (22S99) - 904F77D8-A5B4-4A4E-A0E3-CE178E7E697D (Ready)
      | -- xrOS --
      | xrOS 2.3 (22N895) - 8EB53D86-2805-42E4-85EA-0674CFBB5728 (Ready)
      | xrOS 2.4 (22O237) - AE66836F-A07A-4AA4-B901-E801BE95B14D (Ready)
      |  
      | Total Disk Images: 9 (57.0G)
    
    % xcrun simctl runtime match list
    == Evaluation Results ==
    appletvos18.4:
        SDK Version: 18.4
        SDK Build: 22L251
        Platform: com.apple.platform.appletvos
        Chosen Runtime: tvOS 18.4 (18.4 - 22L254) - com.apple.CoreSimulator.SimRuntime.tvOS-18-4
            User Override: (null)
            Preferred: (null)
            Default: 22L251
    
    iphoneos18.4:
        SDK Version: 18.4
        SDK Build: 22E235
        Platform: com.apple.platform.iphoneos
        Chosen Runtime: iOS 18.4 (18.4 - 22E238) - com.apple.CoreSimulator.SimRuntime.iOS-18-4
            User Override: (null)
            Preferred: (null)
            Default: 22E235
    
    watchos11.4:
        SDK Version: 11.4
        SDK Build: 22T246
        Platform: com.apple.platform.watchos
        Chosen Runtime: watchOS 11.4 (11.4 - 22T250) - com.apple.CoreSimulator.SimRuntime.watchOS-11-4
            User Override: (null)
            Preferred: (null)
            Default: 22T246
    
    xros2.4:
        SDK Version: 2.4
        SDK Build: 22O233
        Platform: com.apple.platform.xros
        Chosen Runtime: visionOS 2.4 (2.4 - 22O237) - com.apple.CoreSimulator.SimRuntime.xrOS-2-4
            User Override: (null)
            Preferred: (null)
            Default: 22O233
    

    After uninstalling older versions:

    % xcrun simctl runtime list
    == Disk Images ==
    -- iOS --
    iOS 18.4 (22E238) - C258D92D-B2F5-4AAB-B02C-767CE9078C82 (Ready)
    -- tvOS --
    tvOS 18.4 (22L254) - A768DFA7-53DB-40DA-A31F-AFB0920AF6D3 (Ready)
    -- watchOS --
    watchOS 11.4 (22T250) - F2764383-628F-4E94-807F-8FF00737429A (Ready)
    -- xrOS --
    xrOS 2.4 (22O237) - AE66836F-A07A-4AA4-B901-E801BE95B14D (Ready)
    

    Still no success, though :(

  24. mattrobmattrob commented on Apr 29, 2025

    @mattrobmattrob

    I'm trying to get it through again in bazelbuild/rules_apple#2703. The builds are so drastically slow like @keith has mentioned though.

    How are you all uninstalling the older runtime versions? For example, I'd expect this missing file to exist (does for my local Xcode 16.2 install anyway):

    FileNotFoundError: [Errno 2] No such file or directory: '/Applications/Xcode16.3.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/DeviceTypes/iPhone 16.simdevicetype/Contents/Resources/profile.plist'
    
  25. fweikert commented on Apr 29, 2025

    @fweikert
    Member

    I was running xcrun simctl runtime delete, just as @keith did in bazelbuild/rules_apple@a44773c

  26. keith commented on Apr 29, 2025

    @keith
    Member

    that output after uninstalling the old simulator runtimes looks right to me

  27. mattrobmattrob commented on Apr 29, 2025

    @mattrobmattrob

    Now it seems like there's an xctestrunner issue where Xcode 16.3 doesn't have the expected path to the simulator device type's profile.plist (simtype_profile.py::profile_plist_obj). I'm trying to figure it out to unblock that part of figuring this out (this dev forum post).

    For example, on my system:

    $ find /Applications/Xcode_16.3.app -type d -name "CoreSimulator"
    /Applications/Xcode_16.3.app/Contents/Developer/Platforms/XROS.platform/Library/Developer/CoreSimulator
    
    $ find /Applications/Xcode_16.2.app -type d -name "CoreSimulator"
    /Applications/Xcode_16.2.app/Contents/Developer/Platforms/AppleTVOS.platform/Library/Developer/CoreSimulator
    /Applications/Xcode_16.2.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator
    /Applications/Xcode_16.2.app/Contents/Developer/Platforms/WatchOS.platform/Library/Developer/CoreSimulator
    /Applications/Xcode_16.2.app/Contents/Developer/Platforms/XROS.platform/Library/Developer/CoreSimulator
    

    Update: Fix for that is in google/xctestrunner#67

  28. meteorcloudy commented on Apr 30, 2025

    @meteorcloudy
    MemberAuthor

    Sorry, we actually rolled back the Xcode 16.3 yesterday due to #2269

  29. fweikert commented on May 14, 2025

    @fweikert
    Member

    How bad is the current situation?

    I still want to upgrade to Xcode 16.3 again, but there are some ongoing problems caused by the zlib update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions