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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Xcode build issues with MacOS Monterey

Discussion in 'iOS and tvOS' started by Johste, Oct 28, 2021.

  1. Johste

    Johste

    Joined:
    Jul 12, 2014
    Posts:
    18
    Hi,

    Issues started appearing when we upgraded the build agent to MacOS Monterey.
    References to similar issues found on the web seem related to older versions of golang.
    Known workarounds don't seem applicable.
    Anything we can do to avoid the issue?

    Reproduced in Xcode 12.4 and Xcode 13.
    Identical CI setup builds fine in Catalina and Big Sur.
    We're using Unity 2019.4.23f1


    Code (CSharp):
    1.  
    2. /bin/sh -c /Users/agent007/Library/Developer/Xcode/DerivedData/Unity-iPhone-brjkcdstlthovoajtjgnpunvevqi/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/UnityFramework.build/Script-F5B74F07A4691D1F0D47112F.sh
    3. fatal error: runtime: bsdthread_register error
    4.  
    5. runtime stack:
    6. runtime.throw(0x1622388, 0x21)
    7.     /usr/local/go/src/runtime/panic.go:605 +0x95 fp=0x7ff7bfef39b0 sp=0x7ff7bfef3990 pc=0x1029c75
    8. runtime.goenvs()
    9.     /usr/local/go/src/runtime/os_darwin.go:108 +0x83 fp=0x7ff7bfef39e0 sp=0x7ff7bfef39b0 pc=0x1027513
    10. runtime.schedinit()
    11.     /usr/local/go/src/runtime/proc.go:492 +0xa1 fp=0x7ff7bfef3a20 sp=0x7ff7bfef39e0 pc=0x102c651
    12. runtime.rt0_go(0x7ff7bfef3a50, 0x3, 0x7ff7bfef3a50, 0x1000000, 0x3, 0x7ff7bfef4d90, 0x7ff7bfef4e06, 0x7ff7bfef4e12, 0x0, 0x7ff7bfef4eef, ...)
    13.     /usr/local/go/src/runtime/asm_amd64.s:175 +0x1eb fp=0x7ff7bfef3a28 sp=0x7ff7bfef3a20 pc=0x10540fb
    14. Command PhaseScriptExecution failed with a nonzero exit code
    15.  
     
    bbmaster, vlasove and dmitry_vasiliev like this.
  2. jerome-lacoste

    jerome-lacoste

    Joined:
    Jan 7, 2012
    Posts:
    206
    My understanding is that this is an old issue triggered from Go on Mac and it can be avoided if the programs (in this case usymtool) are built by changing the way libraries are linked into the final binary (e.g. with)

    Code (CSharp):
    1. export DYLD_LIBRARY_PATH=
    2. go build -ldflags -linkmode=external ....
    and maybe by using go >= 1.11.

    https://github.com/golang/go/issues/8801#issuecomment-66460009
    https://groups.google.com/g/golang-nuts/c/HtcZc3wO-rw
    https://golang.org/doc/go1.11

    Anyone from Unity can comment on this? Maybe @UnityLouisaRogers ?
     
  3. Johste

    Johste

    Joined:
    Jul 12, 2014
    Posts:
    18
    Updating Unity to 2019.4.31f1 seem to have resolved this issue.
     
  4. fechy

    fechy

    Joined:
    Jan 12, 2019
    Posts:
    10
    Unfortunately, this does not work. Still getting the same issue
     
  5. dmitry_vasiliev

    dmitry_vasiliev

    Joined:
    Oct 17, 2017
    Posts:
    5
    Here are what can be done:
    1. Remove Unity Process symbols or Process symbols step from Build Phases in both Unity-iPhone and UnityFramework targets. upload_2021-11-10_14-9-12.png

    2. Or you can empty this script:
    /Applications/Unity/Hub/Editor/[UnityVersion]/PlaybackEngines/iOSSupport/Trampoline/process_symbols.sh. Remove everything except
    #!/bin/sh
    .

    BE AWARE: Crash stack traces in Unity Dashboard will become unreadable.
     
    programacion-6 likes this.
  6. programacion-6

    programacion-6

    Joined:
    Mar 25, 2022
    Posts:
    10
    @dmitry_vasiliev Great !! That solution works.

    But it's strange. That problem only occurs when building from BatchMode. When building directly from the Unity Editor we don't have the problem.

    At first we wondered if It was related to our CI instance not having enough permissions but after some research is clearly not.

    It is possible we might avoid the error by changing our build options on code? Or it's an inevitable bug from iOS batchmode build?

    Here our command for building to iOS:
    Code (CSharp):
    1. public static void BuildiOS()
    2. {
    3.  
    4.  
    5.     BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
    6.  
    7.     buildPlayerOptions.locationPathName = "Users/MyUser/.jenkins/Builds/" + newBuildName;
    8.     buildPlayerOptions.target = BuildTarget.iOS;
    9.  
    10.     List<string> listScenes = new List<string>();
    11.     foreach (var s in EditorBuildSettings.scenes)
    12.     {
    13.         if (s.enabled)
    14.             listScenes.Add(s.path);
    15.     }
    16.  
    17.     buildPlayerOptions.scenes = listScenes.ToArray();
    18.     buildPlayerOptions.options = BuildOptions.None;
    19.  
    20.     BuildPipeline.BuildPlayer(buildPlayerOptions);
    21.  
    22.  
    23. }
     
    bbmaster likes this.
  7. dmitry_vasiliev

    dmitry_vasiliev

    Joined:
    Oct 17, 2017
    Posts:
    5
    @programacion-6
    Found the difference between batchmode and without batchmode. It seems that in batchmode Unity sets this environment argument SYNCHRONOUS_SYMBOL_PROCESSING to TRUE (don't know why). And it is used by the script below to upload debug symbols.
    Adding SYNCHRONOUS_SYMBOL_PROCESSING=FALSE to the xcodebuild command will fix the build.
    Example:
    /usr/bin/xcodebuild -scheme Unity-iPhone -workspace [workspace] -configuration Release clean archive -archivePath [archivePath] DEVELOPMENT_TEAM=[teamID] -allowProvisioningUpdates SYNCHRONOUS_SYMBOL_PROCESSING=FALSE 


    The script which uploads debug symbols:

    #!/bin/sh

    # process_symbols
    #
    # Copyright (c) 2015 Unity Technologies. All rights reserved.

    if [ "${SYNCHRONOUS_SYMBOL_PROCESSING}" = "TRUE" ]; then
    "$PROJECT_DIR/usymtool" -symbolPath "$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME"
    else
    nohup "$PROJECT_DIR/usymtool" -symbolPath "$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME" > /dev/null 2>&1 &
    disown
    fi


    UPD: Ok, it looks like without SYNCHRONOUS_SYMBOL_PROCESSING you won't see a log in console and terminating xcodebuild won't stop DSYM uploading if its already ongoing. When building directly from the Unity Editor the script still fails, but doesn't affect the main process, which is xcodebuild.
     
    Last edited: Mar 26, 2022
  8. an_easytarget

    an_easytarget

    Joined:
    May 5, 2014
    Posts:
    4
    We were able to do something like this to get the local builds working for dev purposes.

    Code (CSharp):
    1. proj.SetBuildProperty(targetGuid, "USYM_UPLOAD_AUTH_TOKEN", "NONE");
    2. proj.SetBuildProperty(targetGuid, "SYNCHRONOUS_SYMBOL_PROCESSING", "False");
    Code (CSharp):
    1. [PostProcessBuildAttribute(1)]
    2. public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) {
    3.         if (target == BuildTarget.iOS)
    4.         {
    5.             string projPath = PBXProject.GetPBXProjectPath(buildPath);
    6.             PBXProject proj = new PBXProject();
    7.             proj.ReadFromFile(projPath);
    8.  
    9.             if (proj != null)
    10.             {
    11.                 string targetGuid = proj.TargetGuidByName(PBXProject.GetUnityTargetName());
    12.                 proj.SetBuildProperty(targetGuid, "USYM_UPLOAD_AUTH_TOKEN", "NONE");
    13.                 proj.SetBuildProperty(targetGuid, "SYNCHRONOUS_SYMBOL_PROCESSING", "False");
    14.                 proj.WriteToFile(projPath);
    15.             }
    16.         }
    17. }
    https://docs.unity3d.com/ScriptReference/Callbacks.PostProcessBuildAttribute.html
     
    Last edited: Apr 12, 2022
    danishgoel likes this.
  9. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    246
    For those who stumble upon this post. I reached out to our Cloud Diagnostics team and this issue is related to how Monterey interacts with applications built using older version of Go. This is a known issue when a tool written with GoLang was built using a version of Go older than 1.11. The Cloud Diagnostics tool was built using GoLang and older versions of Unity are impacted by this bug.

    The Cloud Diagnostics team released a fix for this and versions of Unity including, or newer than the following should not result in a BSD Thread Error when running on Monterey: 2019.4.25f1, 2020.3.5f1, 2021.2.0a1, and any version of 2022.
     
  10. tchapman_lumineye

    tchapman_lumineye

    Joined:
    Sep 1, 2021
    Posts:
    10
    Thanks for noting this here. It might also be worth mentioning that our iOS Cloud Builds started intermittently failing about 2 weeks ago (August 5th 2022) due to this error with no relevant code changes and they were using 2020.3.4. We upgraded those builds to latest 2020.3 (2020.3.37f1 at time of this writing) and it doesn't seem to have resolved the issue. As you can see below, the failures are pretty sporadic and started with #189. #199 and #196 were started at the same time with different versions and were still inconsistent. For context, the only different between Nightly and Prod currently is the icon. Other than that they're identical builds. Any suggestions? upload_2022-8-18_14-34-55.png
    upload_2022-8-18_14-56-40.png
     
    Last edited: Aug 18, 2022
  11. JackmanGomel

    JackmanGomel

    Joined:
    Jun 3, 2015
    Posts:
    25
    Hello. I use 2022.2.2f1 but I get the error