Search Unity

Unable to install CocoPods

Discussion in 'Unity Build Automation' started by allan-oooh, Dec 15, 2020.

  1. allan-oooh

    allan-oooh

    Joined:
    Mar 29, 2019
    Posts:
    53
    As of the resent UCB node update all of our iOS builds are failing with the following message:


    12583: [Unity] ERROR: iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.
    12584: [Unity] After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.
    12585: [Unity] pod install output:
    12586: [Unity] Analyzing dependencies
    12587: [Unity] Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
    12588: [Unity] [!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`.
    12589: [Unity] You can try adding it manually in `/BUILD_PATH/.cocoapods/repos` or via `pod repo add`.
    12590: [Unity] pod repo update output:
    12591: [Unity] UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
    12592: [Unity] UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    12593: [Unity] UnityEngine.Logger:Log(LogType, Object)
    12594: [Unity] UnityEngine.Debug:Log(Object)
    12595: [Unity] UnityEditor.CloudBuild.BuildLogger:Log(String)
    12596: [Unity] UnityEditor.CloudBuild.BuildLogger:HighlightUnityErrors(String, String, LogType)
    12597: [Unity] UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
    12598: [Unity] UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    12599: [Unity] UnityEngine.Logger:Log(LogType, Object)
    12600: [Unity] UnityEngine.Debug:LogError(Object)
    12601: [Unity] Google.Logger:Log(String, LogLevel) (at Z:\tmp\tmp.TYKRiAmuIY\third_party\unity\unity_jar_resolver\source\VersionHandlerImpl\src\Logger.cs:136)
    12602: [Unity] Google.IOSResolver:Log(String, Boolean, LogLevel) (at Z:\tmp\tmp.h5EFniVWKe\third_party\unity\unity_jar_resolver\source\IOSResolver\src\IOSResolver.cs:1032)
    12603: [Unity] Google.IOSResolver:OnPostProcessInstallPods(BuildTarget, String) (at Z:\tmp\tmp.h5EFniVWKe\third_party\unity\unity_jar_resolver\source\IOSResolver\src\IOSResolver.cs:2357)
    12604: [Unity] System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
    12605: [Unity] System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
    12606: [Unity] System.Reflection.MethodBase:Invoke(Object, Object[])
    12607: [Unity] UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
    12608: [Unity] UnityEditor.CloudBuild.Builder:Build()
    12609: [Unity] iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.
    12610: [Unity] After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.
    12611: [Unity] pod install output:
    12612: [Unity] Analyzing dependencies
    12613: [Unity] Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
    12614: [Unity] [!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`.
    12615: [Unity] You can try adding it manually in `/BUILD_PATH/.cocoapods/repos` or via `pod repo add`.
    12616: [Unity] pod repo update output:
    12617: [Unity] UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
    12618: [Unity] UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    12619: [Unity] UnityEngine.Logger:Log(LogType, Object)
    12620: [Unity] UnityEngine.Debug:LogError(Object)
    12621: [Unity] Google.Logger:Log(String, LogLevel) (at Z:\tmp\tmp.TYKRiAmuIY\third_party\unity\unity_jar_resolver\source\VersionHandlerImpl\src\Logger.cs:136)
    12622: [Unity] Google.IOSResolver:Log(String, Boolean, LogLevel) (at Z:\tmp\tmp.h5EFniVWKe\third_party\unity\unity_jar_resolver\source\IOSResolver\src\IOSResolver.cs:1032)
    12623: [Unity] Google.IOSResolver:OnPostProcessInstallPods(BuildTarget, String) (at Z:\tmp\tmp.h5EFniVWKe\third_party\unity\unity_jar_resolver\source\IOSResolver\src\IOSResolver.cs:2357)
    12624: [Unity] System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
    12625: [Unity] System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
    12626: [Unity] System.Reflection.MethodBase:Invoke(Object, Object[])
    12627: [Unity] UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
    12628: [Unity] UnityEditor.CloudBuild.Builder:Build()


    Looking for any advice on how to work around this.

    Thanks
     
  2. dmitry_vaveda

    dmitry_vaveda

    Joined:
    Apr 14, 2020
    Posts:
    5
    Same issue every build.
    Code (CSharp):
    1. 10496: [Unity] ERROR: iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.
    2. 10497: [Unity] After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.
    3. 10498: [Unity] pod install output:
    4. 10499: [Unity] Analyzing dependencies
    5. 10500: [Unity] Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
    6. 10501: [Unity] [!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`.
    7. 10502: [Unity] You can try adding it manually in `/BUILD_PATH/.cocoapods/repos` or via `pod repo add`.
     
  3. allan-oooh

    allan-oooh

    Joined:
    Mar 29, 2019
    Posts:
    53
    Still having this issue, which is almost completely blocking us from being able to use UCB.

    The partial workaround is setting the xcode version to 11.4 in the build configuration, then you get to play build node roulette and occasionally you get one that hasn't been updated to run off the /Volume mount and the build will pass.

    My support ticket is slowly gaining some traction (3 weeks after I gave them all the information that shows it's a problem caused by the node upgrades they've confirmed what I said and are considering escalating the issue), but I really need a solution or a better work around soon.
     
    dmitry_vaveda likes this.
  4. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Okay so I think I've found a real issue. Its dependency clashing while resolving pod install.
    In my case it looks like this:
    upload_2021-1-11_18-31-47.png
    (taken from VM)

    You can find similar message in UCB full log pointing whats clashing with what.
    Haven't built this project for IOS for a while, and updating android sdk also leads to IOS being updated. Yeah.

    How to resolve?

    0. If you're using library as package via Package Manager - go to your /Project/Library/PackagesCache/ and move clashing package to /Project/Packages/.
    (This is to prevent package manager automatic upgrade from updating packages)

    1. Then, find *Dependencies.xml. In there should be an ios pod version. Most of the times you need to set it up to be ~> (higher or equal).

    This will allow cocoapods to install whatever version is minimal requirement.

    After resolving dependencies pod install should work just fine on both local builds and UCB.

    In my case this is caused by Firebase Core / Firebase Analytics package.
    If you have those - this is the issue. No idea why they did not set their min / max versions properly in dependencies.xml. Probably user error.
     
  5. dmitry_vaveda

    dmitry_vaveda

    Joined:
    Apr 14, 2020
    Posts:
    5
    Still having this issue on UCB.
    On local machine Pods resolved without any problem.
     
  6. allan-oooh

    allan-oooh

    Joined:
    Mar 29, 2019
    Posts:
    53
    Just received a resolution on my Unity support ticket and I can confirm that this issue is fixed for my projects now!
     
    xVergilx likes this.
  7. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Not sure if related, but today cloud build can't resolve libraries correctly:
    So now pod install just ignores all library dependencies in podfile. Surely it builds, but libraries are not present in the build.

    Testing clean build right now.
     
    Last edited: Jan 21, 2021
  8. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Clean build doesn't solve lock issue either.
    @victorw please investigate this one as well.
     
  9. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    Why does Podfile.lock and Pods/ directory exist? That's there to prevent us from running unnecessary pod installs and to allow users to create their own custom pod install which won't get overridden. Are they checked into your SCM? Or is a pod install running in an earlier step of the build?
     
  10. allan-oooh

    allan-oooh

    Joined:
    Mar 29, 2019
    Posts:
    53
    I see that message as well in my logs, however I think it's always been there and it doesn't seem to be creating any issues.

    I believe this occurs after the cocapods have been installed in our build flow.
     
  11. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    Yeah, depending on your project setup it's quite likely that the pod install will be run as part of your Unity build, that step happens between the Unity build and the Xcode build as a step to ensure that everything is configured and ready for Xcode to build your project.
     
  12. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Not sure what's going on, but I've used build post processor to remove both /Pods and Podfile.lock.
    Without them pod install resolved correctly, and libraries were included properly.

    Something is messed up in the build pipeline. Not sure what you've done but its wrong (or at least not supported by EDM4U).

    My theory - pods resolves twice. First time on invalid podfile. Second time on valid one, but it cannot do so, due to Podfile.lock.
    External Dependency Manager could also be the case, since it expects to fallback on xcproject on the cloud. That is because previously xcworkspace wasn't supported. Could it potentially be the cause?
     
    Last edited: Jan 21, 2021
  13. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    Yes, pods will often resolve twice - the first time triggered inside of the Unity build process and the second time run as a fallback in the build script before running the Xcode build. It's skipping the second attempt since the first one already ran. I'm not sure why it's generating a Podfile that it requires multiple attempts to install though, you might want to try updating your dependencies or you can submit a support ticket.
     
  14. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Thing is, resolving podfile before any post processor will prevent further modifications done by third-party plugins.
    Such as most if not all of them.

    Not sure if its intended default Unity's behaviour. This first resolve always failed in the past (I think), that's why it never was an issue.

    I guess I'll just use post processor for removing lock & previous files if it is.
    I'm too lazy to submit a ticket, and this will probably make a lot of people angry anyway, so somebody else will. :p
     
  15. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    Unity doesn't run Cocoapods, third-party plugins do it - including EDM4U which you mentioned. If you look at the plugin source you will see that you can work around this with e.g.
    [PostProcessBuildAttribute(45)]
    . If you have multiple plugins modifying the Podfile then it's probably best to file an issue with the responsible plugin.
     
    xVergilx likes this.