Search Unity

[SOLVED] iOS: Build failed (Pushwoosh dependency)

Discussion in 'Unity Build Automation' started by pixelsplit, Jan 24, 2015.

  1. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    173
    Hi,

    unfortunately our iOS build in Unity Cloud Build does fail compiling. Error message:
    Code (CSharp):
    1. [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation)
    The build on local machine via Editor works perfect, I don't modify the XCode project - just Build & run and it works. We are using the InApp Plugin by Prime31 and GameAnalytics, which put some stuff into the Plugin/iOS folder, but this should not be a / the problem?

    Here the XCode build log provided by Unity Cloud build:
    Code (CSharp):
    1.  
    2. [xcode] /APPLICATION_PATH/Xcode6_0_1.app/Contents/Developer/usr/bin/actool --output-format human-readable-text --notices --warnings --export-dependency-info /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/build/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/assetcatalog_dependencies.txt --output-partial-info-plist /opt/workspace/BVR_TEMP_DIR/d20150124-20299-xievo9/build/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/assetcatalog_generated_info.plist --app-icon AppIcon --launch-image LaunchImage --platform iphoneos --minimum-deployment-target 4.3 --target-device iphone --target-device ipad --compress-pngs --compile EXPORT_PATH/frs3.app /opt/workspace/BVR_TEMP_DIR/d20150124-20299-xievo9/Unity-iPhone/Images.xcassets
    3. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Unity-iPhone/Images.xcassets:./AppIcon.appiconset: warning: App Icons built with asset catalogs are unavailable on iOS releases prior to 5.0.
    4. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Unity-iPhone/Images.xcassets:./AppIcon.appiconset: warning: A 57x57@2x app icon is required for iPhone apps targeting releases of iOS prior to 7.0
    5. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Unity-iPhone/Images.xcassets:./AppIcon.appiconset: warning: A 60x60@2x app icon is required for iPhone apps targeting iOS 7.0 and later
    6. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Unity-iPhone/Images.xcassets:./AppIcon.appiconset: warning: A 72x72 app icon is required for iPad apps targeting releases of iOS prior to 7.0
    7. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Unity-iPhone/Images.xcassets:./AppIcon.appiconset: warning: A 72x72@2x app icon is required for iPad apps targeting releases of iOS prior to 7.0
    8. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Unity-iPhone/Images.xcassets:./AppIcon.appiconset: warning: A 76x76 app icon is required for iPad apps targeting iOS 7.0 and later
    9. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Unity-iPhone/Images.xcassets:./AppIcon.appiconset: warning: A 76x76@2x app icon is required for iPad apps targeting iOS 7.0 and later
    10. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Classes/UI/iAD.mm:372:83: warning: 'ADBannerContentSizeIdentifier320x50' is deprecated: first deprecated in iOS 4.2 [-Wdeprecated-declarations]
    11. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Classes/UI/iAD.mm:374:84: warning: 'ADBannerContentSizeIdentifier480x32' is deprecated: first deprecated in iOS 4.2 [-Wdeprecated-declarations]
    12. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Classes/UI/iAD.mm:382:95: warning: 'ADBannerContentSizeIdentifier320x50' is deprecated: first deprecated in iOS 4.2 [-Wdeprecated-declarations]
    13. [xcode] /BUILD_PATH/BVR_TEMP_DIR/d20150124-20299-xievo9/Classes/UI/iAD.mm:384:96: warning: 'ADBannerContentSizeIdentifier480x32' is deprecated: first deprecated in iOS 4.2 [-Wdeprecated-declarations]
    14. [xcode] clang: error: linker command failed with exit code 1 (use -v to see invocation)
    15. [xcode] ** BUILD FAILED **
    16. ! build of 'default-ios' failed. compile failed
    17.  
    Any hint what the error message could mean in our case? How to proceed?

    Best regards,
    Bennet
     
  2. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    Please check your repository ignore file settings if library files like .a are blocked and ensure all library files which are necessary for Prime and GameAnalytics are checked in correctly. Check your extended log for detailed information.
     
  3. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    173
    Ah thanks for the hint regarding the "Full log"! Detected that there is also another dependency: Pushwoosh.

    The error log says:
    Code (CSharp):
    1. 3247:        [xcode] Undefined symbols for architecture armv7:
    2. 3248:        [xcode]   "_kSecValueData", referenced from:
    3. 3249:        [xcode]       -[PushNotificationManager writeDeviceID:] in Pushwoosh.a(PushNotificationManager.o)
    4. 3250:        [xcode]   "_SecItemCopyMatching", referenced from:
    5. 3251:        [xcode]       -[PushNotificationManager readDeviceId] in Pushwoosh.a(PushNotificationManager.o)
    6. 3252:        [xcode]   "_kSecClass", referenced from:
    7. 3253:        [xcode]       -[PushNotificationManager writeDeviceID:] in Pushwoosh.a(PushNotificationManager.o)
    8. 3254:        [xcode]       -[PushNotificationManager readDeviceId] in Pushwoosh.a(PushNotificationManager.o)
    9. 3255:        [xcode]   "_kSecReturnData", referenced from:
    10. 3256:        [xcode]       -[PushNotificationManager readDeviceId] in Pushwoosh.a(PushNotificationManager.o)
    11. 3257:        [xcode]   "_kSecMatchLimit", referenced from:
    12. 3258:        [xcode]       -[PushNotificationManager readDeviceId] in Pushwoosh.a(PushNotificationManager.o)
    13. 3259:        [xcode]   "_kSecClassGenericPassword", referenced from:
    14. 3260:        [xcode]       -[PushNotificationManager writeDeviceID:] in Pushwoosh.a(PushNotificationManager.o)
    15. 3261:        [xcode]       -[PushNotificationManager readDeviceId] in Pushwoosh.a(PushNotificationManager.o)
    16. 3262:        [xcode]   "_kSecAttrService", referenced from:
    17. 3263:        [xcode]       -[PushNotificationManager writeDeviceID:] in Pushwoosh.a(PushNotificationManager.o)
    18. 3264:        [xcode]       -[PushNotificationManager readDeviceId] in Pushwoosh.a(PushNotificationManager.o)
    19. 3265:        [xcode]   "_kSecMatchLimitOne", referenced from:
    20. 3266:        [xcode]       -[PushNotificationManager readDeviceId] in Pushwoosh.a(PushNotificationManager.o)
    21. 3267:        [xcode]   "_kSecAttrAccount", referenced from:
    22. 3268:        [xcode]       -[PushNotificationManager writeDeviceID:] in Pushwoosh.a(PushNotificationManager.o)
    23. 3269:        [xcode]       -[PushNotificationManager readDeviceId] in Pushwoosh.a(PushNotificationManager.o)
    24. 3270:        [xcode]   "_kSecAttrAccessible", referenced from:
    25. 3271:        [xcode]       -[PushNotificationManager writeDeviceID:] in Pushwoosh.a(PushNotificationManager.o)
    26. 3272:        [xcode]   "_kSecAttrAccessibleAlwaysThisDeviceOnly", referenced from:
    27. 3273:        [xcode]       -[PushNotificationManager writeDeviceID:] in Pushwoosh.a(PushNotificationManager.o)
    28. 3274:        [xcode]   "_SecItemAdd", referenced from:
    29. 3275:        [xcode]       -[PushNotificationManager writeDeviceID:] in Pushwoosh.a(PushNotificationManager.o)
    30. 3276:        [xcode] ld: symbol(s) not found for architecture armv7
    Quick googling revelead that the missing referenced things can be found in the Security.framework. Interesting is that this framework is not visible in the local XCode build?

    However I added the framework with the XCode Manipulation API now.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using UnityEditor.Callbacks;
    4. using System.Collections;
    5. using UnityEditor.iOS.Xcode;
    6. using System.IO;
    7.  
    8. public class PushwooshPostProcess : MonoBehaviour {
    9.     [PostProcessBuild]
    10.     public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    11.     {
    12.        
    13.         if (buildTarget == BuildTarget.iPhone) {
    14.             string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
    15.            
    16.             PBXProject proj = new PBXProject();
    17.             proj.ReadFromString(File.ReadAllText(projPath));
    18.            
    19.             string target = proj.TargetGuidByName("Unity-iPhone");
    20.            
    21.             // Add custom system frameworks. Duplicate frameworks are ignored.
    22.             // needed by our native plugin in Assets/Plugins/iOS
    23.             proj.AddFrameworkToProject(target, "Security.framework", false /*not weak*/);
    24.            
    25.             File.WriteAllText(projPath, proj.WriteToString());
    26.         }
    27.     }
    28. }
    Unfortunately the build is still not successfull:
    Code (CSharp):
    1. 2676:        [xcode] 2015-01-24 09:03:53.887 xcodebuild[27550:1007] Unexpected character / at line 1
    2. 2677:        [xcode] xcodebuild: error: Unable to read project 'Unity-iPhone.xcodeproj'.
    3. 2678:        [xcode]     Reason: Project /BUILD_PATH/BVR_TEMP_DIR/d20150124-26914-bbhrr5/Unity-iPhone.xcodeproj cannot be opened because the project file cannot be parsed.
    Seems like the XCode project gets corrupted by the code above (which is mostly copy paste from the XCode Manipulation API Example).
     
  4. pixelsplit

    pixelsplit

    Joined:
    Sep 16, 2013
    Posts:
    173
    Got it working now. The problem was, that I copied the iOS.Xcode.Extensions.dll from the example. This dll seems to be outdated(?).
    Now i pulled the .cs files (https://bitbucket.org/Unity-Technologies/xcodeapi/src) and added them to "Editor/XCode Manipulation API". The final script i am using (in order to avoid build errors on android), i am using the following script:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using UnityEditor.Callbacks;
    4. using System.Collections;
    5. #if UNITY_IOS
    6. using UnityEditor.iOS.Xcode;
    7. #endif
    8. using System.IO;
    9.  
    10. public class PushwooshPostProcess : MonoBehaviour {
    11.     [PostProcessBuild]
    12.     public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    13.     {
    14. #if UNITY_IOS
    15.         if (buildTarget == BuildTarget.iPhone) {
    16.             string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";
    17.      
    18.          
    19.             PBXProject proj = new PBXProject();
    20.             proj.ReadFromString(File.ReadAllText(projPath));
    21.          
    22.             string target = proj.TargetGuidByName("Unity-iPhone");
    23.          
    24.             // Add custom system frameworks. Duplicate frameworks are ignored.
    25.             // needed by our native plugin in Assets/Plugins/iOS
    26.             proj.AddFrameworkToProject(target, "Security.framework", false /*not weak*/);
    27.          
    28.             File.WriteAllText(projPath, proj.WriteToString());
    29.             //Debug.Log(proj.WriteToString());
    30.         }
    31. #endif
    32.     }
    33. }
    34.  
    Thread can be closed :)
     
    hypeNate likes this.
  5. David-Berger

    David-Berger

    Unity Technologies

    Joined:
    Jul 16, 2014
    Posts:
    745
    Thank you for the update! I was not aware this could cause a problem.