Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6 simulator build missing symbol for _clock$UNIX2003

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

like image 324
Culzean Avatar asked Sep 17 '14 14:09

Culzean


2 Answers

Add the following at the end of main.mm.

#include <time.h>

extern "C"
{
clock_t
clock$UNIX2003(void)
{
    return clock();
}
}
like image 68
user1235155 Avatar answered Jan 04 '23 05:01

user1235155


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.

like image 45
Jeremy Huddleston Sequoia Avatar answered Jan 04 '23 06:01

Jeremy Huddleston Sequoia