6

I'm building a Unity project for an iOS8 simulator. Moving this for Xcode 6 GM for the simulator has resulted in this linker error. Not sure if I'm missing something in the build or something is broken. Any suggestions? The full error is:

Undefined symbols for architecture i386: "_clock$UNIX2003", referenced from: _substanceHandleSwitchHard in libiPhone-lib.a(apihandle.o) _mainRenderProcess in libiPhone-lib.a(mainrenderprocess.o) ld: symbol(s) not found for architecture i386

Exit with code 1

Culzean
  • 349
  • 3
  • 13

2 Answers2

8

Add the following at the end of main.mm.

#include <time.h>

extern "C"
{
clock_t
clock$UNIX2003(void)
{
    return clock();
}
}
user1235155
  • 447
  • 6
  • 21
  • Definitely do NOT do this. You will simply mask a deeper bug in that you are linking in object files that are not binary compatible with the iOS Simulator runtime. – Jeremy Huddleston Sequoia Sep 23 '14 at 22:13
  • This may be correct, @JeremyHuddlestonSequoia, but it's the current workaround provided by the Unity team (see http://forum.unity3d.com/threads/ios8-xcode6-compatibility.249533/page-2#post-1769753). – coeing Oct 14 '14 at 12:27
  • Well then the Unity developers need to get their act together and provide you developers with a proper build of unity for the iOS Simulator instead of giving you one built against the OS X SDK. – Jeremy Huddleston Sequoia Oct 14 '14 at 14:59
  • Also note my response to them in that same thread: http://forum.unity3d.com/threads/ios8-xcode6-compatibility.249533/page-2#post-1785319 – Jeremy Huddleston Sequoia Oct 14 '14 at 15:01
  • Thanks! it worked for me to just skip the compilation error - yea on Unity 3d – Ayyappa May 14 '15 at 20:08
3

clock$UNIX2003 is a symbol that is provided by OS X and is not part of the iOS Simulator runtime. iOS is always conformant and thus does not have legacy (non $UNIX2003) variants of functions (which are provided for binary compatibility with code built against older versions of the OS X SDK).

The common cause of the issue you are seeing is that you have an object file or archive (libsomething.a) that was built against the OS X SDK and are trying to link it into your iOS Simulator executable. That is not supported as the two platforms are not binary compatible at that layer.

You need to rebuild your library (the libsomething.a) against the iOS Simulator SDK.

Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86
  • I required this for testing against iOS8. In the end it was released and I was able to test on an actual device. This issue was confined to the simulator. – Culzean Sep 25 '14 at 01:40
  • @culzean It's not an issue with the simulator. It's an issue with the library that you're trying to link into your simulator executable. The iOS Simulator and OS X runtimes are not binary compatible, and it looks like Unity developers were incorrectly shipping an OSX-compatible static library of Unity for use in the iOS Simulator. In the past, this just resulted in runtime errors, but now it results in compile time errors in more cases than it used to. Hopefully the update is actually a build of Unity against the iOS Simulator SDK and not something with extra hacks to mask the bugs. – Jeremy Huddleston Sequoia Sep 26 '14 at 06:27
  • please tell me how to rebuild libsomething.a – Hardik Vyas Feb 17 '16 at 10:23