Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

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

Discussion in 'Unity Cloud Build' started by Magicware, May 18, 2017.

  1. Magicware

    Magicware

    Joined:
    Oct 3, 2016
    Posts:
    18
    Hello, the cloud build for iOS for our project fails with the following messge:
    [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation)

    This happens only on iOS build, Android builds successfully and the app runs as expected. Since the application is built with Unity 5.3.6, this is also the version, which is set up in the cloud build and results in the error above. The full log is pretty long (almost 9k lines), but near the error is the following:

    8951: [xcode] Undefined symbols for architecture armv7:
    8952: [xcode] "_OBJC_CLASS_$_FIRDynamicLinks", referenced from:
    8953: [xcode] objc-class-ref in libInvites.a(invites_receiver_internal_ios_1230d75baa8748d15aaa58c8ca55fdb3.o)
    8954: [xcode] "_OBJC_CLASS_$_FIRInvitesTargetApplication", referenced from:
    8955: [xcode] objc-class-ref in libInvites.a(invites_sender_internal_ios_5a5f1fae9c2e05cb8ca5aae49485e16f.o)
    8956: [xcode] "_OBJC_CLASS_$_FIRApp", referenced from:
    8957: [xcode] objc-class-ref in libApp.a(app_ios_3c1f2f5540e3edfbae8c7bf918ae5900.o)
    8958: [xcode] "_OBJC_CLASS_$_GIDSignIn", referenced from:
    8959: [xcode] objc-class-ref in libInvites.a(invites_sender_internal_ios_5a5f1fae9c2e05cb8ca5aae49485e16f.o)
    8960: [xcode] objc-class-ref in libInvites.a(invites_receiver_internal_ios_1230d75baa8748d15aaa58c8ca55fdb3.o)
    8961: [xcode] "_OBJC_CLASS_$_FIRInvites", referenced from:
    8962: [xcode] objc-class-ref in libInvites.a(invites_sender_internal_ios_5a5f1fae9c2e05cb8ca5aae49485e16f.o)
    8963: [xcode] objc-class-ref in libInvites.a(invites_receiver_internal_ios_1230d75baa8748d15aaa58c8ca55fdb3.o)
    8964: [xcode] "_OBJC_CLASS_$_FIROptions", referenced from:
    8965: [xcode] objc-class-ref in libApp.a(app_ios_3c1f2f5540e3edfbae8c7bf918ae5900.o)
    8966: [xcode] ld: symbol(s) not found for architecture armv7
    8967: [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Any idea why this is happening and how to proceed?
     
  2. TobyKaos

    TobyKaos

    Joined:
    Mar 4, 2015
    Posts:
    145
    Missing firebase framework for IOS.
    You can add framework like this in a postbuild method (see UCB doc) https://docs.unity3d.com/Manual/UnityCloudBuildPreAndPostExportMethods.html

    For instance:
    Code (CSharp):
    1. [PostProcessBuild(101)]
    2.     public static void OnPostprocessBuild(BuildTarget buildTarget, string buildPath) {
    3.  
    4.         Debug.Log ("Post Process Custom");
    5.  
    6.         // BuiltTarget.iOS is not defined in Unity 4, so we just use strings here
    7.         if (buildTarget.ToString () == "iOS" || buildTarget.ToString () == "iPhone") {
    8.             Debug.Log("Post Process Custom IOS");
    9.             string projPath = buildPath + "/Unity-iPhone.xcodeproj/project.pbxproj";
    10. //#if UNITY_IOS
    11.             PBXProject proj = new PBXProject();
    12.             proj.ReadFromString(File.ReadAllText(projPath));
    13.  
    14.             string target = proj.TargetGuidByName("Unity-iPhone");
    15.             //Google Analytics
    16.             proj.AddFrameworkToProject(target, "CoreData.framework", false);
    17.  
    18.             //
    19.             proj.AddFileToBuild(target, proj.AddFile("usr/lib/libsqlite3.0.tbd", "Frameworks/libsqlite3.0.tbd", PBXSourceTree.Sdk));
    20.  
    21.             //adcolony
    22.             proj.AddFileToBuild(target, proj.AddFile("usr/lib/libz.1.2.5.tbd", "Frameworks/libz.1.2.5.tbd", PBXSourceTree.Sdk));
    23.             //proj.AddBuildProperty(target, "CODE_SIGN_ENTITLEMENTS", PBXProject.GetUnityTargetName()+"/"+)
    24.             //Firebase
    25.             //proj.AddFrameworkToProject(target, "UserNotifications.framework", false);
    26.  
    27.  
    28.             File.WriteAllText(projPath, proj.WriteToString());
    29.  
    30.             // Get plist
    31.             string plistPath = buildPath + "/Info.plist";
    32.             PlistDocument plist = new PlistDocument();
    33.             plist.ReadFromString(File.ReadAllText(plistPath));
    34.  
    35.             // Get root
    36.             PlistElementDict rootDict = plist.root;
    37.             // Change value of CFBundleVersion in Xcode plist
    38.             var buildKey = "UIBackgroundModes";
    39.             rootDict.CreateArray (buildKey).AddString ("remote-notification");
    40.  
    41.             buildKey = "NSPhotoLibraryUsageDescription";
    42.             rootDict.SetString(buildKey, "Some ad content may require access to the photo library.");
    43.             //buildKey = "NSCameraUsageDescription";
    44.             //rootDict.SetString(buildKey, "Some ad content may access camera to take picture.");
    45.             buildKey = "NSMotionUsageDescription";
    46.             rootDict.SetString(buildKey, "Some ad content may require access to accelerometer for interactive ad experience.");
    47.             buildKey = "NSCalendarsUsageDescription";
    48.             rootDict.SetString(buildKey, "Some ad content may create a calendar event.");
    49.             // Write to file
    50.             File.WriteAllText(plistPath, plist.WriteToString());
    51. //#endif
    52.         }
    53.  
    54.  
    55.     }
    But Firebase will use POD and UCB does not allow POD config. You must build locally if you use firebase.
     
  3. Magicware

    Magicware

    Joined:
    Oct 3, 2016
    Posts:
    18
    Thank you for the prompt reply!
    Meaning build locally in unity and then directly upload from xcode, right?

    Any idea if there is any sharing framework, which would allow us to use cloud build? We REALLY LOVE IT!! :)