Search Unity

Unity 4.2 Crittercism

Discussion in 'Editor & General Support' started by CPXTom, Jul 25, 2013.

  1. CPXTom

    CPXTom

    Joined:
    Apr 24, 2010
    Posts:
    113
    We have been using Crittercism in our games to track crashes and now it looks like Unity 4.2 is doing the same (CrashReporter). This is great, except now I'm not able to build due to duplicate symbols errors during linking :( Is there anyway we can resolve this?
     
  2. wbrock

    wbrock

    Joined:
    Jan 8, 2013
    Posts:
    2
    Our team is encountering this problem, as well. As of Unity 4.2, both libraries seem to include/define a bunch of PLCrashReport classes. As they're both closed source static libraries, I'm a bit stumped as to how to proceed. Would have to hear if you or anyone else has a solution.
     
  3. Smilediver

    Smilediver

    Joined:
    May 5, 2011
    Posts:
    72
    The problem is that both Unity and Crittercism use PLCrashReporter library to catch crashes, hence the linking conflicts. I don't think there's an easy fix, if at all. One possible way would be to modify library archives and remove offending objects. Note that this is a theoretical fix that I haven't tried, so it's very likely that it doesn't work.

    So after you build the project with Unity, open console and navigate to generated project. Go into Library folder, which contains Unity's libs. And these are commands you can use to modify them:

    The following commands will extract libs for the given architecture from the "fat" file. Resulting files will be armv7.a, armv7-dev.a and i386.a.
    Code (csharp):
    1. lipo libiPhone-lib.a -thin armv7 -output armv7.a
    2. lipo libiPhone-lib-dev.a -thin armv7 -output armv7-dev.a
    3. lipo libiPhone-lib-i386.a -thin i386 -output i386.a
    You can use these commands to list all objects in the library, and find what you need to remove.
    Code (csharp):
    1. ar -t armv7.a | grep libC
    2. ar -t armv7-dev.a | grep libC
    3. ar -t i386.a | grep libC
    Run these to remove libCrashReporter* objects
    Code (csharp):
    1. ar -d armv7.a libCrashReporter-iphoneos.a-armv7-master.o
    2. ar -d armv7-dev.a libCrashReporter-iphoneos.a-armv7-master.o
    3. ar -d i386.a libCrashReporter-iphonesimulator.a-i386-master.o
    And finally put arvm7.a, armv7-dev.a and i386.a libs back into the main archive
    Code (csharp):
    1. lipo libiPhone-lib.a -replace armv7 armv7.a -o libiPhone-lib.a
    2. lipo libiPhone-lib-dev.a -replace armv7 armv7-dev.a -o libiPhone-lib-dev.a
    3. lipo libiPhone-lib-i386.a -replace i386 i386.a -o libiPhone-lib-i386.a
    This is a bit risky thing to do, but I think it should work if Unity's and Crittercism's library versions don't have major differences. Also note that similar thing probably can be done on Crittercism lib if you don't want to mess with Unity's libs, or if modifying Unity's libs haven't worked.
     
    rendermouse likes this.
  4. CPXTom

    CPXTom

    Joined:
    Apr 24, 2010
    Posts:
    113
    This did allow me to link fine and crittercism reports that it initializes successfully, however I'm not seeing crashes in our Dashboard. However I did this on the crittercism library, I will try it on libiphone and see if that fixes everything. Thanks!

    Edit:post upon further inspection it seems our old build (still 4.1.5) isn't sending reports either, so maybe it does work! I'll update when I figure it out.

    Edit: Alright, I guess "Live" is not as live as I thought :p Seems to be working, thanks a lot!
     
    Last edited: Jul 26, 2013
  5. Sorry to be a bit off topic...
    I've seen and ask questions about crash reporters before but have never had anyone using crittercism reply. Does it work well with Unity for both iOS and Android? Do you really get all the crashes?
    What I have noticed, is that crashes in Unity (before 4.2) on devices rarely creates crash logs (for exemple, crash logs that can be seen in Xcode Organizer). We tried integrating HockeyApp but didn't receive crash reports. I figure that since no crash logs were created, none could be caught by HockeyApp.
    We had no solution to retrieve crashes on remote devices during beta testing and after the live release (except a few on google developer console) and it was a real disadvantage of using Unity for us.
     
  6. CPXTom

    CPXTom

    Joined:
    Apr 24, 2010
    Posts:
    113
    We've used Crittercism in several projects for over a year now and it works fine on iOS. This is the first project we've used that integrates Crittercism for Android, it seems to be working fine as well.
     
  7. wbrock

    wbrock

    Joined:
    Jan 8, 2013
    Posts:
    2
    Thanks to Smilediver, that solution works great. LikCPXTom I modified the Crittercism library so that we don't have to deal with Unity overwriting the change in the future.

    We started using Crittercism recently. It's easy to integrate (aside from this issue), and provides good information for at least some of the crashes that we see. Considering Unity is using the same library now, I imagine it will provide the same information. The advantage of Crittercism will be the interface they provide for viewing and tracking that info.
     
  8. Smilediver

    Smilediver

    Joined:
    May 5, 2011
    Posts:
    72
    This is because Mono is catching exceptions, things like accessing null pointers, etc. Since these are unhandled exceptions Mono performs a nice shutdown through exit(), iOS sees that and thinks that application has done its work and didn't actually crashed. This was improved in 4.2 as now Unity will simulate a crash in this case, and it will force iOS to generate a standard report with all the stack traces, etc.
     
  9. I've integrated Crittercism for both iOS and Android using these plugins and so far so good. For iOS, I've followed the procedure above and have it working by trimming the libiPhone-lib.a.

    However, I would prefer to trim the crittercism lib. When trying to do so, i get this error:
    Code (csharp):
    1. ar -d libCrittersismUnityThin.a libCrashReporter-iphoneos.a-armv7-master.o
    2. /usr/bin/ranlib: object: libCrittersismUnityThin.a(CrittercismUnity.o) malformed object (unknown load command 1)
    3. ar: internal ranlib command failed
    Any ideas as to what the problem is?
    Would anyone mind sharing their trimmed ios crittercism lib?
     
  10. Smilediver

    Smilediver

    Joined:
    May 5, 2011
    Posts:
    72
    @bagelbaker: can you provide all the commands you're using? And what are the outputs of:

    Code (csharp):
    1. file libCrittersismUnityThin.a
    2. ar -t libCrittersismUnityThin.a | grep libC
     
  11. Here you go:
    Code (csharp):
    1. $ lipo libCrittercismUnity.a -thin armv7 -output libCrittersismUnityThin.a
    2. $ file libCrittersismUnityThin.a
    3. libCrittersismUnityThin.a: current ar archive random library
    4. $ ar -t libCrittersismUnityThin.a | grep libC
    5. libCrashReporter-iphoneos.a-armv7-master.o
    6. $ ar -d libCrittersismUnityThin.a libCrashReporter-iphoneos.a-armv7-master.o
    7. /usr/bin/ranlib: object: libCrittersismUnityThin.a(CrittercismUnity.o) malformed object (unknown load command 1)
    8. ar: internal ranlib command failed
     
  12. Smilediver

    Smilediver

    Joined:
    May 5, 2011
    Posts:
    72
    Everything looks good, but I have no idea why it fails. The only thing that comes to my mind is that it's because of the tool version differences.
     
  13. I was on Mac OS X 10.7.5 with Xcode 4.6.1.

    I upgraded, now I'm on Mac OS X 10.8.4 with Xcode 4.6.3 (+ download of command line tools) and no more errors.
     
  14. NinjaSudo

    NinjaSudo

    Joined:
    Aug 21, 2013
    Posts:
    1
    This issue should be resolved in 4.2.1 of Unity, there should no longer be duplicate symbols.

    As this version isn't yet GA, if you need access to this version, contact support@crittercism.com and they should be able to get your access. :)
     
    Last edited: Aug 21, 2013
  15. eczkchtl

    eczkchtl

    Joined:
    Dec 12, 2012
    Posts:
    14
    We're just about to add Crittercism to our project, but I guess we might as well wait for Unity 4.2.1 before doing so.