6
votes

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

2

2 Answers

8
votes

Add the following at the end of main.mm.

#include <time.h>

extern "C"
{
clock_t
clock$UNIX2003(void)
{
    return clock();
}
}
3
votes

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.