Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Linker failure on iOS after update from 2021 LTS to [Unity Editor: 2022.3.5f1 LTS]

Discussion in 'iOS and tvOS' started by TheLegoless, Jul 18, 2023.

  1. TheLegoless

    TheLegoless

    Joined:
    Mar 10, 2022
    Posts:
    3
    Hello,

    we've updated Unity Editor from 2021.3.28f1 LTS to 2022.3.5f1 LTS and we're now struggling to build our iOS Unity app. We're integrating Unity as a Library, not using Unity-iPhone project. So previously in 2021 versions, we included UnityFramework.framework that was compiled as a a target in Unity-iPhone.xcodeproj in our main application bundle and everything worked without issues. But 2022 seems to change this and a new static library called GameAssembly is built, which is linked to UnityFramework target.

    In Unity-iPhone project this works well, for both Unity-iPhone target and UnityFramework framework. However, using the same setup, if we embed UnityFramework into our project as before, UnityFramework (not our main app) will fail to build with the following error:

    Code (Boo):
    1. ld: library not found for -lGameAssembly
    2. clang: error: linker command failed with exit code 1 (use -v to see invocation)
    So according to the logs, it is looking for GameAssembly static library to be linked, but it does not find it, before UnityFramework is compiled. I do not understand why is this a problem only when UnityFramework is being built to be embedded from a target outside of Unity-iPhone project, but works when inside.

    What would be a fix/workaround for this?

    Search paths on all targets are set correctly, so really have no clue what is Xcode missing.
    Xcode version: 14.3.1

    Thank you for your help!
     
  2. PavelLU

    PavelLU

    Unity Technologies

    Joined:
    Feb 23, 2017
    Posts:
    106
    Hi, Can you please check if minimal project still reproducing this issue?
    With the empty unity project do your way of integrating it to an empty ios template host application is issue still reproducible?
     
  3. TheLegoless

    TheLegoless

    Joined:
    Mar 10, 2022
    Posts:
    3
    Yes, the issue was reproducible directly. We fixed it using an Editor postprocessor script. The problem was the selected SDK is set for any platform, thus it was by default built for macOS, not iOS for which we were building for. When we forced SDK to be iphoneos, it started to work.

    Code (CSharp):
    1. project.SetBuildPropertyForConfig(buildConfig, "SDKROOT", "iphoneos");