Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

XCode 5 + Unity 4.2.2 on OS X 10.8.5

Discussion in 'iOS and tvOS' started by VirtualGreg, Oct 15, 2013.

  1. VirtualGreg

    VirtualGreg

    Joined:
    Oct 15, 2013
    Posts:
    7
    Hey guys,

    I tried searching around but didn't find anything that matched exactly so wanted to see if this is user error on my part or something else...

    I've been working on a PoC for an iOS project but haven't had access to OS X for any sort of live testing until this evening. My hope was to gauge performance in the Simulator. I was able to get my hands on a MacBook Air running OS X 10.8.5, ported my project to a fresh install of Unity 4.2.2, and built a version of the game and threw it into XCode 5. This is pretty much a pristine OS X install I'm playing with at this stage.

    I went through most Player Settings within Unity prior to hitting Build, most notably:
    - Target Resolution : iPhone + iPad.
    - SDK Version : Simulator SDK.
    - Target iOS Version : Numerous, including 4.3, 6.0, etc.

    I opened the project in XCode via Finder, and have tried numerous simulation settings but I constantly hit the following error in there:
    Undefined Symbols for architecture i386:
    "DebugStringToFile(char const*, int, ... )", references from:
    prcore::Surface::ClearImage(prcore ....)
    prcore::Surface::BlitImage(prcore...)
    ld: symbols(s) not found for architecture i386
    clang: error: linker command failed with exit code 1

    I wondered if it was my Unity Project so I fired up the Angry Bots demo and got the same result so I'm curious if this is something stupid (I'm fumbling through the OS X stuff at the moment) on my end, or if this is among the teething issues with XCode 5 that I've read some of since researching this.

    I can't find anything searching for "unity" and "debugstringtofile" in google so I'm at a loss.

    Any thoughts on if an earlier version of XCode will be of use?

    Apologies in advance if this is the wrong place to dump this question.

    Thanks,
    Greg
     
  2. VirtualGreg

    VirtualGreg

    Joined:
    Oct 15, 2013
    Posts:
    7
    I back-levelled Xcode to 4.6.3, fully removing Xcode 5 and attempted to run this in Unity-iPhone -> iPhone 6.1 Simulator and it failed in exactly the same way.

    The colleague who loaned me the MacBook Air informed me that OS X 10.8.5 is pretty new as well - has anyone had any luck deploying to Xcode from Unity 4.2.2?

    Thanks,
    Greg
     
  3. VirtualGreg

    VirtualGreg

    Joined:
    Oct 15, 2013
    Posts:
    7
    Just in case it's useful to have the full error I'm getting:
    Ld /Users/mainuser/Library/Developer/Xcode/DerivedData/Unity-iPhone-aghucglfqoigfjabbekqalsriszr/Build/Products/angryBots.app/angryBots normal i386
    cd /Users/Shared/Unity/4-0_AngryBots/blah
    setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/mainuser/Library/Developer/Xcode/DerivedData/Unity-iPhone-aghucglfqoigfjabbekqalsriszr/Build/Products -L/Users/Shared/Unity/4-0_AngryBots/blah -L/Users/Shared/Unity/4-0_AngryBots/blah/Libraries -F/Users/mainuser/Library/Developer/Xcode/DerivedData/Unity-iPhone-aghucglfqoigfjabbekqalsriszr/Build/Products -filelist /Users/mainuser/Library/Developer/Xcode/DerivedData/Unity-iPhone-aghucglfqoigfjabbekqalsriszr/Build/Intermediates/Unity-iPhone.build/Debug-iphonesimulator/Unity-iPhone.build/Objects-normal/i386/angryBots.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -weak_framework CoreMotion -weak-lSystem -stdlib=libstdc++ -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework OpenAL -liconv.2 -liPhone-lib -framework AudioToolbox -framework CFNetwork -framework MediaPlayer -framework CoreLocation -framework SystemConfiguration -weak_framework iAd -framework CoreMedia -framework CoreVideo -weak_framework AVFoundation -framework CoreGraphics -weak_framework CoreMotion -weak_framework GameKit -o /Users/mainuser/Library/Developer/Xcode/DerivedData/Unity-iPhone-aghucglfqoigfjabbekqalsriszr/Build/Products/angryBots.app/angryBots

    Undefined symbols for architecture i386:
    "DebugStringToFile(char const*, int, char const*, int, int, int, int, int)", referenced from:
    prcore::Surface::ClearImage(prcore::color32 const, prcore::Surface::ClearMode) in libiPhone-lib.a(blitter_integer.o)
    prcore::Surface::BlitImage(prcore::Surface const, prcore::Surface::BlitMode) in libiPhone-lib.a(blitter_integer.o)
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
     
  4. heartfollower

    heartfollower

    Joined:
    Oct 15, 2013
    Posts:
    1
    Yesterday I used unity4.1 + xcode5, It was all ok. When upgrade to unity4.2.2f1, problem came out...
    Is that a unity4.2.2f1's bug?

     
  5. VirtualGreg

    VirtualGreg

    Joined:
    Oct 15, 2013
    Posts:
    7
    And just as an additional datapoint.

    I removed Unity 4.2.2 from the MacBook, installed Unity 4.2.1, and I was able to compile and run the Xcode version of AngryBots with no such issues. This was Xcode 4.6.3, not Xcode 5, emulating an iPhone running iOS 6.0.

    heartfollower's suggestion that this was introduced with Unity 4.2.2f1 appears to have some merit, but I'm afraid I don't know anywhere near enough about what Unity does with a project and what Xcode is tripping up on to be able to offer any more insight. I'll have the MacBook AIr for this evening so if anyone wants any additional info let me know, though I suspect this should be reasonably recreatable.

    Thanks,
    Greg
     
  6. eric.so

    eric.so

    Joined:
    Jun 19, 2013
    Posts:
    15
    Having the same issue just after upgrading the Unity 4.2.2 from Unity 4.2.1. :(
     
  7. anhnguyen

    anhnguyen

    Joined:
    Oct 15, 2012
    Posts:
    8
    I have no experience on OSX but just use it for IOS Unity porting. I also face this problem :(. Hope it is soon answered from someone...
     
  8. CostelloNicho

    CostelloNicho

    Joined:
    Aug 9, 2012
    Posts:
    9
    Bump for: same issue same error.
     
  9. xavier.andrade.85

    xavier.andrade.85

    Joined:
    Oct 19, 2013
    Posts:
    1
    I have the same issue, I tried with the angry bots project and have the same results.

    Undefined symbols for architecture i386:
    "DebugStringToFile(char const*, int, char const*, int, int, int, int, int)", referenced from:
    prcore::Surface::ClearImage(prcore::color32 const, prcore::Surface::ClearMode) in libiPhone-lib.a(blitter_integer.o)
    prcore::Surface::BlitImage(prcore::Surface const, prcore::Surface::BlitMode) in libiPhone-lib.a(blitter_integer.o)
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    It works ok with the device.
     
  10. CBsticks

    CBsticks

    Joined:
    Nov 26, 2012
    Posts:
    1
    ...Me too, having the exact same issue, only since upgrading today to the super-newest release of Unity (v4.2.2f1) Xcode 5.

    When building/running - I'm unable to get it to compile fully; instead it now shows 2 Errors (Preventing it from building/running). The errors are the exact one(s) mentioned above:

    Xcode 5 compilation info (Errors):

    Undefined symbols for architecture i386:
    "DebugStringToFile(char const*, int, char const*, int, int, int, int, int)", referenced from:
    prcore::Surface::ClearImage(prcore::color32 const, prcore::Surface::ClearMode) in libiPhone-lib.a(blitter_integer.o)
    prcore::Surface::BlitImage(prcore::Surface const, prcore::Surface::BlitMode) in libiPhone-lib.a(blitter_integer.o)
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


    ...I'm not a programming wizard, but when building a project in Unity for iOS apps; should the "i386" architecture even be used?

    UPDATE:
    I finally got *some* things to work when NOT using a 'Development Build'; setting the SDK version to 'Device SDK'; and the Target iOS Version to 'Unknown'...
    And it mostly-ran...However, there are definitely some significant problems with even the newest release of Unity and using it with (at least) XCode 5...

    Many of the 'Player Settings' that I set in Unity; such as things like the 'Device Orientation', and so on - were *NOT* sent/saved in the Xcode project correctly; and I had to change them in Xcode manually...Which is less than ideal obviously.

    Also, it seems that the "Development Build' setting in Unity causes many other issues (including totally un-compilable projects, which are shown by the many failed build attempts by other people in the messages above...

    So finally, it appears that there are still multiple issues that are causing major issues when using Unity and (At least) Xcode 5 together...Glad to know that I'm not alone for once.
     
  11. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,472
    same issue.

    So current solution is downgrade unity from 4.2.2 to 4.2.1?
     
  12. VirtualGreg

    VirtualGreg

    Joined:
    Oct 15, 2013
    Posts:
    7
    Downgrading Unity was the path of least resistance for me...
     
  13. eric.so

    eric.so

    Joined:
    Jun 19, 2013
    Posts:
    15
    I think the libPhone.a for simulator is missing the definition of that function "DebugStringToFile". Sounds like is a easy fix on that.
     
  14. unity_bang

    unity_bang

    Joined:
    Oct 16, 2013
    Posts:
    4
    facing same problem with latest unity , is this forum monitored by unity developers or is there a separate way to raise tickets in failing unity builds?
     
  15. unity_bang

    unity_bang

    Joined:
    Oct 16, 2013
    Posts:
    4
    How is that an easy fix? Can you elaborate?
     
  16. eric.so

    eric.so

    Joined:
    Jun 19, 2013
    Posts:
    15
    Not for me. But I wish Unity developer can fix in the library.
     
  17. savo89

    savo89

    Joined:
    Oct 24, 2013
    Posts:
    1
    Same problem here... Unity 4.2.2 does not work correctly with xcode.. :-x
     
  18. mbzdmvp

    mbzdmvp

    Joined:
    May 24, 2013
    Posts:
    21
    Submitted a bug report through Unity with a link to this forum.
     
  19. I deal 3d

    I deal 3d

    Joined:
    Jun 7, 2013
    Posts:
    2
    How long do we have to wait for Unity people to address this issue? A link to this bug report should be on this page since this is the only page that appears when googling this particular error
     
  20. Mikea15

    Mikea15

    Joined:
    Sep 20, 2012
    Posts:
    93
    I have the same issue here. I hope someone can answer on how to fix this issue. I wouldn't want to downgrade Unity3D.
     
  21. MGleem

    MGleem

    Joined:
    Jun 21, 2013
    Posts:
    9
    Xcode 4.6.3 + unity3d 4.2.2 on OSX 10.7.5 have the same error. for now DO NOT DOWNLOAD 4.2.2
     
  22. vero_chan

    vero_chan

    Joined:
    Oct 29, 2013
    Posts:
    3
    I am facing this problem too, for now, I'll downgrade Unity to 4.2.1... I was getting mad at the computer.
     
  23. ShaneStevens

    ShaneStevens

    Joined:
    Nov 16, 2012
    Posts:
    14
    Hi everyone. Just add the empty function to main.mm (in xcode) and you're good to go.

    Code (csharp):
    1. #import <UIKit/UIKit.h>
    2.  
    3. #include "RegisterClasses.h"
    4. #include "RegisterMonoModules.h"
    5.  
    6. // Hack to work around iOS SDK 4.3 linker problem
    7. // we need at least one __TEXT, __const section entry in main application .o files
    8. // to get this section emitted at right time and so avoid LC_ENCRYPTION_INFO size miscalculation
    9. static const int constsection = 0;
    10. bool UnityParseCommandLine(int argc, char *argv[]);
    11. void UnityInitTrampoline();
    12.  
    13.  
    14. // WARNING: this MUST be c decl (NSString ctor will be called after +load, so we cant really change its value)
    15. const char* AppControllerClassName = "UnityAppController";
    16.  
    17.  
    18. int main(int argc, char *argv[])
    19. {
    20.     NSAutoreleasePool* pool = [NSAutoreleasePool new];
    21.  
    22.     UnityInitTrampoline();
    23.     if(!UnityParseCommandLine(argc, argv))
    24.         return -1;
    25.  
    26.     RegisterMonoModules();
    27.     NSLog(@"-> registered mono modules %p\n", &constsection);
    28.  
    29.     UIApplicationMain(argc, argv, nil, [NSString stringWithUTF8String:AppControllerClassName]);
    30.  
    31.     [pool release];
    32.     return 0;
    33. }
    34.  
    35. void DebugStringToFile(char const*, int, char const*, int, int, int, int, int) {
    36.    
    37. }
    38.  
    39.  
    - Shane
     
  24. MGleem

    MGleem

    Joined:
    Jun 21, 2013
    Posts:
    9
    Shane, Build Succeeded!!!, thanks to you.
    Tested Xcode 4.6.3 + unity3d 4.2.2 on OSX 10.7.5
     
  25. eric.so

    eric.so

    Joined:
    Jun 19, 2013
    Posts:
    15
    You rock! Can we put this version of main.mm inside Assets/Plugin/iOS folder?
     
  26. b0wnie

    b0wnie

    Joined:
    Jun 14, 2013
    Posts:
    5
    Was tearing my hair out what with Unity version, MacOs upgrade to Mavericks, XCode version. Thanks for the tips guys - think this is pretty poor QA from Unity.
     
  27. TheStone

    TheStone

    Joined:
    May 18, 2013
    Posts:
    77
    Just as a note, I used my other version of Unity 4.2.1f4 and everything compiled with out problem, it look like Unity introduced a big bug here... in 4.2.2 would not compile on either of my computers.

    The Stone.
     
    Last edited: Nov 7, 2013
  28. Mobiletainment

    Mobiletainment

    Joined:
    May 2, 2013
    Posts:
    4
    Update: Problem got fixed in Unity 4.3:
    • iOS: Fixed iOS7 simulator support.
    • iOS: Fixed Xcode 5 build run for simulator target

    See Release Notes
     
  29. droido

    droido

    Joined:
    Jan 27, 2014
    Posts:
    9
    I know Xcode 5.1 and iOS 7.1 are still in development so Unity operation is not guaranteed, but I want to point that Latest Unity v.4.3.3f1 won't build and run with those beta versions.
    You will have to build and open xcode project manually.
     
  30. Tasmia

    Tasmia

    Joined:
    Sep 12, 2013
    Posts:
    1
    I have tried it my own ... it's a bug in unity you need to add following line at the end of main.mm file

    Code (csharp):
    1.  
    2. void DebugStringToFile(char const*, int, char const*, int, int, int, int, int){}
    3.  
     
  31. SoBrian

    SoBrian

    Joined:
    Dec 23, 2013
    Posts:
    11
    I've had the same problem, and like everyone else, I hope someone from Unity will weigh in on the issue.
     
  32. Interface247

    Interface247

    Joined:
    Feb 19, 2015
    Posts:
    3
    Getting this in Unity 4.6.3f1 the above suggestion did not fix it for me. :( not sure what to do now.