Search Unity

error: linker command failed - Unity 2017.3.0f3 + Unity Ads 2.2.0

Discussion in 'Unity Ads & User Acquisition' started by petak_core, Mar 13, 2018.

Thread Status:
Not open for further replies.
  1. petak_core

    petak_core

    Joined:
    Nov 19, 2012
    Posts:
    57
    Hi to all,

    I have issue with iOS build + Unity Ads package, when I try to build very simple test application of Unity Ads with Xcode I'm always getting these linker error:

    Code (csharp):
    1.  
    2. duplicate symbol _UnityAdsCopyString in:
    3.  
    4.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-6D362980BD529555.o
    5.  
    6.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-5A58B2CEE8B214AA.o
    7.  
    8. duplicate symbol _OBJC_CLASS_$_UnityAdsUnityWrapperDelegate in:
    9.  
    10.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-6D362980BD529555.o
    11.  
    12.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-5A58B2CEE8B214AA.o
    13.  
    14. duplicate symbol _OBJC_METACLASS_$_UnityAdsUnityWrapperDelegate in:
    15.  
    16.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-6D362980BD529555.o
    17.  
    18.     /Users/petak/Library/Developer/Xcode/DerivedData/Unity-iPhone-aflmhnsuschfxpenpatmdnypjbax/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/arm64/UnityAdsUnityWrapper-5A58B2CEE8B214AA.o
    19.  
    20. ld: 3 duplicate symbols for architecture arm64
    21.  
    I'm using Unity 2017.3.0f3 + Unity Ads 2.2.0 + Xcode 9.2.
    Do you have any ideas how to solved this error ?

    Thank you for any tips or advice.
     
  2. mikaisomaa

    mikaisomaa

    Unity Technologies

    Joined:
    Sep 14, 2015
    Posts:
    365
    Hi,

    Thanks for bringing this up!

    Do you by chance have Unity Ads integrated from the Asset Store and also the Services window?

    Please disable the Ads integration from the Services window and let me know if it helps.
     
  3. rasmus-unity

    rasmus-unity

    Moderator

    Joined:
    Aug 15, 2014
    Posts:
    1,312
    Hi,

    Alternatively try to clean Library and obj folders for your project. We have our own example game released on App Store using almost identical setup: 2017.3.1f1, Ads SDK 2.2.0 and Xcode 9.2

    So have tested and verified an almost similar configuration as yours.

    Let us know if you still need help. You can also see if you can repro using our example project at https://github.com/Unity-Technologies/unity-ads-assetstore-test

    /Rasmus
     
  4. petak_core

    petak_core

    Joined:
    Nov 19, 2012
    Posts:
    57
    Hi mikaisomma,

    thank you for your quick and correct answer, after I tried disable Unity Ads from Unity Editor Services Panel, my Xcode Test project doesn't have any build linker error.

    So thank you so much! And sorry for my late answer.

    Ps.: I make my own fix with Editor API and Xcode API, which is great for future...
    https://bitbucket.org/Unity-Technologies/xcodeapi

    but your solution is so sharp and clean ;-)

    Code (csharp):
    1.  
    2. using System.IO;
    3. using UnityEditor;
    4. using UnityEditor.Callbacks;
    5. using UnityEditor.iOS.Xcode;
    6. using UnityEngine;
    7.  
    8. public static class RemoveUnityAdsXcode
    9. {
    10.    [PostProcessBuild]
    11.    public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
    12.    {
    13.       if (buildTarget != BuildTarget.iOS)
    14.          return;
    15.  
    16.      
    17.       string[] filesToRemove = {
    18.          "Classes/UnityAds/UnityAdsUnityWrapper.mm"
    19.       };
    20.  
    21.       string pbxprojPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
    22.       PBXProject proj = new PBXProject();
    23.       proj.ReadFromString(File.ReadAllText(pbxprojPath));
    24.  
    25.       foreach(string name in filesToRemove)
    26.       {
    27.          string fileGuid = proj.FindFileGuidByProjectPath(name);
    28.          if (fileGuid != null)
    29.          {
    30.             Debug.Log ("Removing " + name + " from xcode project");
    31.             proj.RemoveFile(fileGuid);
    32.          }
    33.       }
    34.  
    35.       File.WriteAllText(pbxprojPath, proj.WriteToString());
    36.    }
    37. }
    38.  
    39.  
     
  5. TortoRacoon

    TortoRacoon

    Joined:
    Apr 17, 2019
    Posts:
    61
    So how do we get Unity ads to run properly if it's dissabled in Services, do we delete the assets? Thank you very much, I have the same problem
     
  6. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Since this is an old thread, it might be helpful to start a new thread (or support ticket) and provide as much detail as possible for your issue. Specifically, we would need:
    • Are you building your game with Unity, XCode, or Android Studio?
    • If Unity, which version are you using?
    • Which version of the Ads SDK are you using?
    • Can you share the code you are using to integrate Unity Ads?
    • Can you provide a device log from your app when Unity Ads is initialized?
    • Are you using mediation? If so, which version of the mediation SDK and adapter are you using?
    • How pervasive is this problem? Is it reproducible 100% of the time or do you have metrics on how often it happens?
     
Thread Status:
Not open for further replies.