Search Unity

Bug Project won't build using Xode15 release candidate.

Discussion in 'iOS and tvOS' started by VentaGames, Sep 13, 2023.

  1. Tommy0814

    Tommy0814

    Joined:
    Jul 20, 2017
    Posts:
    2
    Updating the Unity version in Unity hub from 2022.3.9f1 to 2022.3.10f1 will solve the problem immediately, with no extra hurdles.
     
  2. JeppeNygaard

    JeppeNygaard

    Joined:
    Dec 7, 2010
    Posts:
    13
    Thank you so much - this did the trick for me! ... I updated MacOS and updated Unity to 2022.3.10f1 - now I'm happy building again!
     
    drewjosh likes this.
  3. Manish_hbb

    Manish_hbb

    Joined:
    Dec 5, 2019
    Posts:
    2
    Thanks a lot, this helped me.
    Uninstalled xcode 15 and installed xcode 14.3.1
    And I could build again
     
  4. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    https://developer.apple.com/forums/thread/735426
     
    realima92 likes this.
  5. Shaggy21

    Shaggy21

    Joined:
    Oct 2, 2014
    Posts:
    24
    Hey there, I'm using XCode 15 RC, MacOS Ventura 13.6 and my iPhone 13 is iOS 17, using Unity 2021.2.5f
    While the Xcode build is working, I cannot use Metal Frame Capture (I go to the Edit Scheme -> Options -> Capture GPU Frame -> select Metal, and in Build Configuration I select Release). Any idea why that is? This did work back in iOS 16 and XCode 14.3, while still using this same Unity version.

    Screenshot 2023-10-04 at 16.57.46.png
     
  6. sandolkakos

    sandolkakos

    Joined:
    Jun 3, 2009
    Posts:
    285
    That works for me as well. Thanks, @dmarqs and @drewjosh for adding more details.
    I'm using Unity 2023.1.16 + Xcode 15.0
    And here is my contribution to make it even easier:

    upload_2023-10-4_16-23-59.png
     
  7. silviu-georgian77

    silviu-georgian77

    Joined:
    Jan 17, 2016
    Posts:
    12
    For everyone that is still experiencing the problem even if you've got Sonoma + Xcode 15.0 + 2022.3.10f1, try the following:

    1. Quit Unity
    2. From your game's iOS build folder, delete everything.
    3. From your game's Unity main project folder, delete the Library and Temp folders.
    4. Re-open your project and let Unity do all the re-importing.
    5. Build again and see if it works.
     
    hartzogcr and Razorfane like this.
  8. archimi_swiss

    archimi_swiss

    Joined:
    Oct 13, 2014
    Posts:
    4
    I have the same problem here with Unity 2022.3.10 and Xcode 15 -> Two Errors :

    - Assertion failed: (false && "compact unwind compressed function offset doesn't fit in 24 bits"), function operator(), file Layout.cpp, line 5758.

    and

    - Linker command failed with exit code 1 (use -v to see invocation)
     
  9. sandolkakos

    sandolkakos

    Joined:
    Jun 3, 2009
    Posts:
    285
    Try adding the `-ld64` following the steps:
    - https://forum.unity.com/threads/pro...release-candidate.1491761/page-2#post-9389312
     
    eecorp and Alexander-Dalbert like this.
  10. danielszweda_math

    danielszweda_math

    Joined:
    Jun 20, 2023
    Posts:
    2
    Just like some here, this issue was not solved by upgrading Unity to 2022.3.10f1. In order to simplify the process for everyone here is a post build script to resolve the issue. Happy Coding!


    Code (CSharp):
    1. using System.IO;
    2. using UnityEditor;
    3. using UnityEditor.Callbacks;
    4. using UnityEditor.iOS.Xcode;
    5. using UnityEngine;
    6.  
    7. public class AppleBuildPostProcessor: MonoBehaviour {
    8.   [PostProcessBuild(1)]
    9.   public static void OnPostProcessBuild(BuildTarget target, string path) {
    10.     if (target == BuildTarget.iOS) {
    11.       ModifyValues(path);
    12.     }
    13.   }
    14.  
    15.   private static void ModifyValues(string path) {
    16.     var projectPath = PBXProject.GetPBXProjectPath(path);
    17.     var project = new PBXProject();
    18.     project.ReadFromFile(projectPath);
    19.  
    20.     project.AddBuildProperty(frameworkTargetGuid, "OTHER_LDFLAGS", "-ld64");
    21.  
    22.     project.WriteToFile(projectPath);
    23.   }
    24. }
     
  11. this-Array

    this-Array

    Joined:
    Jun 11, 2013
    Posts:
    13
  12. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,085
    this seems no longer true
     
  13. PotatoBoomer

    PotatoBoomer

    Joined:
    May 5, 2023
    Posts:
    1
    Sonoma, xcode15,
    Report https://issuetracker.unity3d.com/is...latforms-fails-with-xcode-15-dot-0b6-or-newer implies that the issue has been fixed.

    I am still getting:

    ld: Assertion failed: (false && "compact unwind compressed function offset doesn't fit in 24 bits"), function operator(), file Layout.cpp, line 5758.

    clang: error: linker command failed with exit code 1 (use -v to see invocation)


    The solution is not to write hacky post process scripts or
    -ld_classic
    flags, butUnity should fix the issue to their product.
     
    ilezhnin likes this.
  14. mmomin_504

    mmomin_504

    Joined:
    May 8, 2021
    Posts:
    14
    Download Xcode beta 15 version 5 and placing it in the Applications folder worked for me.
    Plus
    > Unity Framework > Build Settings > Other Linker Flags (you can search for it) > double click on value + hit plus on button > add "-ld64" > hit Enter >
     
    Last edited: Oct 19, 2023
    OLGV likes this.
  15. nnoom1986

    nnoom1986

    Joined:
    Jan 9, 2018
    Posts:
    27
    This isn't solving it for me with Xcode 15.0.1 and Unity 2022.3.11f1. Having Beta 5 alongside the latest version was working until these latest updates, and now it's broken again with the same errors.

    Assertion failed: (false && "compact unwind compressed function offset doesn't fit in 24 bits"), function operator(), file Layout.cpp, line 5758.
    Linker command failed with exit code 1 (use -v to see invocation)
     
  16. mmomin_504

    mmomin_504

    Joined:
    May 8, 2021
    Posts:
    14
    Did you add "-ld64" or "-ld_classic" in other linker flags for Unity Framework?
    Also, please share the detailed screen shot of the error. Thanks
     
  17. this-Array

    this-Array

    Joined:
    Jun 11, 2013
    Posts:
    13
    These flags break functionality in Odin Serialization and who knows what else. My fix right now is to go back to xcode 14 which doesnt work on sonoma.
     
  18. MartinPegg

    MartinPegg

    Joined:
    Oct 7, 2016
    Posts:
    1
    It appears from my own testing that the -ld64 or -ld_classic linker is only needed if the minimum iOS target is less than 15.0. Whether or not you want to exclude anyone on iOS 14 and below is another question.
     
    g8rew, sandolkakos and mmomin_504 like this.
  19. IvovdMarel

    IvovdMarel

    Joined:
    Jun 1, 2014
    Posts:
    9
    Upgrading from 2023.1.12f1 to 2023.1.18f1 fixed it for me.
     
    sandolkakos likes this.
  20. RaventurnStefan

    RaventurnStefan

    Joined:
    Aug 1, 2012
    Posts:
    44
    Unfortunately not for us, but with the workaround (-ld64) it works.
     
  21. konsnos

    konsnos

    Joined:
    Feb 13, 2012
    Posts:
    121
    The issue was resolved with 2022.3.10f1 for us and reappeared with 2022.3.11f1. The workaround seems to work in our case.
     
  22. NoisyNitGames

    NoisyNitGames

    Joined:
    Mar 23, 2020
    Posts:
    2
    Upgrading from 2022.3.6f1 to 2022.3.13f1 fixed it for me.

    XCode 15.0.1 apple silicon
     
  23. Christopher-Anderson-GISP

    Christopher-Anderson-GISP

    Joined:
    Mar 5, 2015
    Posts:
    19
    Upgrading from 2022.3.6f1 to 2022.3.13f1 did not work for me. and i'm also on XCode 15.0.1 apple silicon.

    Are there any other solutions?
     
    Last edited: Nov 11, 2023
  24. VincentBarnoux

    VincentBarnoux

    Joined:
    Dec 20, 2022
    Posts:
    2
    Unfortunatly it seems not. 2022.3.13f1 and Xcode 15.0.1 still give the assertion error.
    The -ld_classic trick is working only when you build brand new Xcode project. If you get error once and do the trick after it won't work.
     
  25. Christopher-Anderson-GISP

    Christopher-Anderson-GISP

    Joined:
    Mar 5, 2015
    Posts:
    19
    Here's an update to my situation. I was finally able to get a build from unity to archive and push to TestFlight. The solution (or what i think fixed it) was to remove the compiler flags that Unity's standard assets use for mobile devices (CROSS_PLATFORM_INPUT, and MOBILE_INPUT). Now i'll still have to replace the code so my app will function, but after I did that I was able to use 2022.3.13f1 and Xcode 15.0.1 to make an iOS build and push to TestFlight. Is there anybody that confirm what I've seen?
     
    Last edited: Nov 13, 2023
  26. TarekBV

    TarekBV

    Joined:
    Jul 25, 2022
    Posts:
    1
    A workaround worked for me is by commenting the first three lines in the SignInWithApplePostprocessor class and add the AuthenticationServices.framework to the link binary to UnityFramework and add Sign in with Apple capability to the Unity-iPhone in Signing & Capabilities:

    // #if UNITY_IOS || UNITY_TVOS
    // #define UNITY_XCODE_EXTENSIONS_AVAILABLE
    // #endif
     
  27. mischmit

    mischmit

    Joined:
    Jan 13, 2022
    Posts:
    1
    This also happens to me with
    • Unity 2022.3.13f1
    • Xcode 15.0.1
    But only when setting Managed Stripping Level to "Medium" or "High".
    It Does not happen on levels "Minimal" or "Low".
     
  28. Shamahan

    Shamahan

    Joined:
    Oct 1, 2017
    Posts:
    5
    For me what seemed to work was updating Unity from v2022.3.11f1 to v2022.3.14f1
    Then reinstalling Xcode to v15.0.1

    Then in Xcode under PROJECT select Unity-iPhone, select the Build Settings and search for "Other Linker Flags" and double click it, then add "-ld64" to it. (-LD64, not -ID64)

    The project archived successfully, but it gave me an error when uploading it to AppStore Connect.
    I fixed this issue by selecting "UnityFramework", then in Build Settings set "Always Embed Swift Standard Libraries" to No
     
  29. bendogami

    bendogami

    Joined:
    Feb 8, 2023
    Posts:
    5
    nice one but how do you find "frameworkTargetGuid" is there a missing part of the code ?
     
  30. bendogami

    bendogami

    Joined:
    Feb 8, 2023
    Posts:
    5
    ok found it just add.
    Code (CSharp):
    1. var frameworkTargetGuid = project.GetUnityFrameworkTargetGuid()
    before the AddBuildProperty
     
  31. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
    The error re-appeared for me with Unity 2022.3.13f1 when trying to build an existing iOS app for visionOS. The -ld_classic trick did not work.
     
  32. ahodge

    ahodge

    Joined:
    Sep 21, 2018
    Posts:
    2
    This is still an issue with my projects as of Unity 2022.3.14f1 and Xcode 15.0.1. The suggested linker flags don't work.
     
  33. Christopher-Anderson-GISP

    Christopher-Anderson-GISP

    Joined:
    Mar 5, 2015
    Posts:
    19
    It's gotten to the point that for every unity build I make for iOS, I have to delete the xcode project, build, add the missing linker, and only then can I build and archive. But if a single build failure occurs I have to start the whole process again. I don't understand how something this simple is still an issue with unity. And yes, I think its on unity to fix this since it's the one building the initial project. Having to hack a post process for this is ridiculous. Can some one at unity at least confirm if they care about fixing this? I've been having this issue for the past 4 or 5 unity versions.
     
    kustom likes this.
  34. alliedcgames

    alliedcgames

    Joined:
    Jul 14, 2023
    Posts:
    1
    Thank you , for complete understanding , it helped out
     
  35. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    300
    after updating mac os I get the same problem,I not understand why every time apple try so hard to make problems on EVERYTHING

    put -ld64 NOT WORK form me
    there is any other solution for this?
    I am on unity 2023.1.13
     
    Last edited: Dec 9, 2023
  36. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    300
    I try adding this code:

    1. var frameworkTargetGuid = project.GetUnityFrameworkTargetGuid()
    But STILL have the error: "PhaseScriptExecution failed with a nonzero exit code"
     
  37. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    300
    did you solve with the -ld64 flag? because that not work for me
     
  38. mcmadafly

    mcmadafly

    Joined:
    Jan 29, 2023
    Posts:
    1
    Same issue. A brand new Unity project and I can not Build and Run.

    Changing to Target SDK: Simulator SDK and/or -ld64 does not work.

    Mac M1
    XCode - Version 15.0.1 (15A507)
    Unity - 2022.3.15f1

    XCode Produces errors like:

    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 dependency analysis" in the script phase.

    Sandbox: il2cpp(51172) deny(1) file-read-data /Users/Mada/_games/x/Il2CppOutputProject/IL2CPP/build/deploy_arm64/il2cpp
     
    jason_unity999 and Scorpion_1980 like this.
  39. el_Guero

    el_Guero

    Joined:
    Sep 15, 2017
    Posts:
    185
    I updated the iOS of my test device to v17.2 and was forced to update to XCode 15 and had the exact same problem. No matter what I tried suggested here or in other threads, helped me to solve the error.

    In my case I got the:
    DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR

    It appeared for pretty much every SDK I was using like Applovin, Firebase, Facebook... even if I manually changed those to TOOLCHAIN_DIR, it wouldn't build.

    Today I finally solved it and results that the problem actually is with Cocoapods (who would have thought :D). So forget about post processor build scripts or any other solution you find here. What you need to do is to install the correct Cocoapods version corresponding to your Unity editor.

    You might want to update first to the latest Unity LTS version of your choice.

    Then to solve the error do this:

    1. Open Terminal and type:
    Code (CSharp):
    1. gem list
    2. Delete all listed packages related to Cocoapods:


    By typing:
    Code (CSharp):
    1. gem uninstall cocoapods
    2. gem uninstall cocoapods-core
    3. gem uninstall cocoapods-deintegrate
    4. gem uninstall cocoapods-downloader
    5. gem uninstall cocoapods-plugins
    6. gem uninstall cocoapods-search
    7. gem uninstall cocoapods-trunk
    8. gem uninstall cocoapods-try
    In case you do not have permission use "sudo gem uninstall cocoapods" instead.

    3. After deleting all cocoapods packages go back to unity. Then Assets -> External dependency manager -> IOS resolver -> Install Cocoapods

    4. (optional) Make sure that cocoapods installed correctly by typing 'pod' in your terminal, if it says that command was not found then run 'sudo gem install cocoapods'

    I use Unity 2022 LTS and it installed Cocoapods v1.14.3.
    I exported my game into an entirely fresh folder and everything runs smooth again. I do not use -ld64 or anything else.

    Original source from another cocoapods problem:
    https://forum.unity.com/threads/ios...ods-installation-failure.483511/#post-6548239
     
  40. peacefulshade

    peacefulshade

    Joined:
    Jul 25, 2012
    Posts:
    12
    Had this issue and I can confirm that the cocoapods solution works.

    Here's a link to install google's external dependency manager unitypackage:

    https://github.com/googlesamples/unity-jar-resolver

    It will correctly update cocoapods for iOS builds on M1 macs (my case) hopefully this helps.
     
  41. anrelivant

    anrelivant

    Joined:
    May 30, 2023
    Posts:
    7
    I faced this issue for 2 - 3 hours these steps fixed for me;
    • Upgrade Unity Editor version 2022.3.8f1 to 2022.3.17f1
    • Add
      Code (CSharp):
      1. -ls
      command line to Xcode UnityFramework/BuildSettings/Linking-General/OtherLinkerFlags/Debug/ "Last Line"
     
    Christin2015 likes this.
  42. Christin2015

    Christin2015

    Joined:
    Dec 1, 2015
    Posts:
    48
    This worked for my project.
     
  43. drewjosh

    drewjosh

    Joined:
    Sep 24, 2019
    Posts:
    30
    @waldgeist

    Did you try updating to Unity 2022.3.18? And did you try the workaround mentioned earlier?

    My system:
    - Apple M1 Max
    - macoS 14.3
    - Unity 2022.3.18
    - Xcode 15.2

    I currently don't have to do the workaround anymore to build successfully, which is great :)
     
  44. Scorpion_1980

    Scorpion_1980

    Joined:
    Jun 21, 2016
    Posts:
    24

    Attached Files:

  45. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Which version of Unity are you using? It looks like you might have a different error than the one described in that bug report. I'd first like to confirm that you are trying a version of Unity that includes this fix.
     
  46. Scorpion_1980

    Scorpion_1980

    Joined:
    Jun 21, 2016
    Posts:
    24
    2023.1.16f1 , 2022.3.19f1 , 2022.3.18f1
     
  47. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Ok, so it looks like you should have the fix for that issue. Other users have confirmed that it corrects the problem on their machines, so I suspect that this is a different issue.

    Looking around a bit, it might be something like this: https://stackoverflow.com/questions...write-data-users-xxx-ios-pods-resources-to-co

    Can you have a look at the "ENABLE_USER_SCRIPT_SANDBOXING" setting in Xcode maybe?
     
    drewjosh likes this.
  48. Scorpion_1980

    Scorpion_1980

    Joined:
    Jun 21, 2016
    Posts:
    24
     

    Attached Files:

    Last edited: Feb 12, 2024
  49. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    Does it work if you change this to a value of "No"?
     
  50. Scorpion_1980

    Scorpion_1980

    Joined:
    Jun 21, 2016
    Posts:
    24
    I didn’t understand what specific target should be set to (no), I set it to everything, the build started moving and started processing, but then the error occurred again. Thanks!
     

    Attached Files: