Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Mac, you must have Xcode installed.

I get this error after updating Xcode to 15. It was working fine just before updating.

The app is created with Flutter containing flutter-unity-widget plugin.

Full error

... continue ...
    Function: createItemModels(for:itemModelSource:)
    Thread:   <_NSMainThread: 0x124e0a050>{number = 1, name = main}
    Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    2023-11-22 09:44:57.461 xcodebuild[64038:2655521] [MT] DVTAssertions: Warning in
    /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEF
    rameworks-22269/IDEFoundation/Provisioning/Capabilities Infrastructure/IDECapabilityQuerySelection.swift:103
    Details:  createItemModels creation requirements should not create capability item model for a capability item model that
    already exists.
    Function: createItemModels(for:itemModelSource:)
    Thread:   <_NSMainThread: 0x124e0a050>{number = 1, name = main}
    Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
    ** BUILD FAILED **


Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/cv/yb103sl92sn87wng_mvscb_80000gn/T/flutter_tools.T5NLXl/flutter_ios_build_temp_dirjmiuWj/temporary_xcresult_bund
        le

    /Users/tenna/Desktop/ai_chara/ios/UnityLibrary/Il2CppOutputProject/IL2CPP/build/deploy_arm64/il2cpp --compile-cpp
    --platform=iOS --architecture=arm64 --outputpath=libGameAssembly.a --libil2cpp-static
    --baselib-directory=/Users/tenna/Desktop/ai_chara/ios/UnityLibrary/Libraries --additional-defines=IL2CPP_DEBUG=0
    --incremental-g-c-time-slice=3 --configuration=Release --dotnetprofile=unityaot-macos --profiler-report
    --profiler-output-file=/Users/tenna/Library/Developer/Xcode/DerivedData/Runner-bcftqgeocxzxveemrkiekqlvuozs/Build/Intermediates
    .noindex/Unity-iPhone.build/Debug-iphoneos/artifacts/profile.json --print-command-line
    --external-lib-il2-cpp=/Users/tenna/Desktop/ai_chara/ios/UnityLibrary/Libraries/libil2cpp.a
    --data-folder=/Users/tenna/Desktop/ai_chara/unity/AIChara-App/Library/Bee/artifacts/iOS/il2cppOutput/data
    --generatedcppdir=Il2CppOutputProject/Source/il2cppOutput --architecture=arm64
    --outputpath=/Users/tenna/Desktop/ai_chara/build/ios/Debug-iphoneos/libGameAssembly.a
    --cachedirectory=/Users/tenna/Library/Developer/Xcode/DerivedData/Runner-bcftqgeocxzxveemrkiekqlvuozs/Build/Intermediates.noind
    ex/Unity-iPhone.build/Debug-iphoneos/artifacts/arm64 --configuration=Debug
    Starting:
    /Users/tenna/Desktop/ai_chara/ios/UnityLibrary/Il2CppOutputProject/IL2CPP/build/deploy_arm64/bee_backend/mac-arm64/bee_backend
    --profile="/Users/tenna/Library/Developer/Xcode/DerivedData/Runner-bcftqgeocxzxveemrkiekqlvuozs/Build/Intermediates.noindex/Uni
    ty-iPhone.build/Debug-iphoneos/artifacts/arm64/buildstate/backend_profiler0.traceevents" --beedriver-listener
    --dagfile="/Users/tenna/Library/Developer/Xcode/DerivedData/Runner-bcftqgeocxzxveemrkiekqlvuozs/Build/Intermediates.noindex/Uni
    ty-iPhone.build/Debug-iphoneos/artifacts/arm64/buildstate/bee.dag" --continue-on-failure FinalProgram
    WorkingDir:
    /Users/tenna/Library/Developer/Xcode/DerivedData/Runner-bcftqgeocxzxveemrkiekqlvuozs/Build/Intermediates.noindex/Unity-iPhone.b
    uild/Debug-iphoneos/artifacts/arm64/buildstate
    ExitCode: 4 Duration: 0s152ms
    ExitCode: 1 Duration: 0s2ms
    Build failed with 0 successful nodes and 0 failed ones
    Error: Internal build system error. BuildProgram exited with code 1.
    Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build
    C++ code for Mac, you must have Xcode installed.
    Building for Apple Silicon requires Xcode 9.4 and Mac 10.12 SDK.

    Xcode needs to be installed in the /Applications directory and have a name matching Xcode*.app. Or be selected using
    xcode-select.
    It's also possible to use /Library/Developer/CommandLineTools if those match the listed requirements.

    More information and installation instructions can be found here:
    https://developer.apple.com/support/xcode/

    Specific Xcode versions can be downloaded here:
    https://developer.apple.com/download/more/

    Unable to detect any compatible iPhoneOS SDK!


       at Unity.IL2CPP.Bee.BuildLogic.iOS.iOSBuildLogic.GetCompatibleXcodeInstallation(Architecture architecture, Version
       xcodeMinVersion, Version platformSdkMinVersion, Identifier platformSdkIdentifier, XcodePlatformSdk& compatiblePlatformSdk,
       XcodeInstallation& compatibleXcodeInstallation)... continue ...

    Error: Unity.IL2CPP.Building.BuilderFailedException: Build failed with 0 successful nodes and 0 failed ones
    Error: Internal build system error. BuildProgram exited with code 1.
    Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build
    C++ code for Mac, you must have Xcode installed.
    Building for Apple Silicon requires Xcode 9.4 and Mac 10.12 SDK.

    Xcode needs to be installed in the /Applications directory and have a name matching Xcode*.app. Or be selected using
    xcode-select.
    It's also possible to use /Library/Developer/CommandLineTools if those match the listed requirements.

    More information and installation instructions can be found here:
    https://developer.apple.com/support/xcode/

    Specific Xcode versions can be downloaded here:
    https://developer.apple.com/download/more/

    Unable to detect any compatible iPhoneOS SDK!

       at Unity.IL2CPP.Bee.BuildLogic.iOS.iOSBuildLogic.GetCompatibleXcodeInstallation(Architecture architecture, Version
... continue ...
    note: Removed stale file
    '/Users/tenna/Library/Developer/Xcode/DerivedData/Runner-bcftqgeocxzxveemrkiekqlvuozs/Build/Products/Debug-iphoneos/google_sign
    _in_ios/google_sign_in_ios.framework'
... continue ...

    warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address
    this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on
... continue ...

I found this thread, but downgrading Xcode causes other issues, so rather not do that. https://forum.unity.com/threads/project-wont-build-using-xode15-release-candidate.1491761/

I tried to run the app from Xcode, also did not work.

Accepted Reply

Updating Unity to 2022.3.14f1 solved the issue (and caused another error seems not related to the issue).

Replies

Sorry, but you must post this on the Unity & Flutter forums or revert Xcode to a version supported by Unity & Flutter.

The issue first appeared more than 3 months ago. https://forum.unity.com/threads/project-wont-build-using-xode15-release-candidate.1491761/#post-9341597

I guess both the Unity and the Xcode developers have no intension to fix this..

I posted the issue to the Flutter repo. https://github.com/flutter/flutter/issues/138938

Updating Unity to 2022.3.14f1 solved the issue (and caused another error seems not related to the issue).