juicycleff / flutter-unity-view-widget

Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demo
BSD 3-Clause "New" or "Revised" License
2.09k stars 505 forks source link

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. #901

Open ChurikiTenna opened 7 months ago

ChurikiTenna commented 7 months ago

Describe the bug After updating to Xcode 15, this error starts to show on flutter run.

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.

To Reproduce Steps to reproduce the behavior:

  1. Install Xcode 15
  2. add this plugin to the project
  3. flutter run

Expected behavior No error

Unity (please complete the following information):

Smartphone (please complete the following information):

Additional context

Log

... 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 I would rather not do that. https://forum.unity.com/threads/project-wont-build-using-xode15-release-candidate.1491761/

timbotimbo commented 7 months ago

This is an issue with Unity and Xcode 15, Flutter and this plugin don't really have anything to do with it. I believe you are more likely to find the solution on the Unity forums or stackoverflow than here,

I had some issues with Xcode 15, but never ran into this one.

Some general tips for Xcode 15 that helped me:

I also experimented with the linker flags mentioned on the Unity forums, but I can't remember if that actually helped.

Ahmadre commented 6 months ago

This can also be an issue with missing flavors. Make sure your Unity Project in XCode has the same BuildConfigurations as your root Runner Project!