Iphone simulator (linker command failed with exit

2019-07-31 16:54发布

I am using Unity to build iPhone game. When I build for iPhone simulator I got this annouing error: I tried to build for iOS 4.2 and later versions... but no hope..

ld: -pie can only be used when targeting iOS 4.2 or later
clang: error: linker command failed with exit code 1 (use -v to see invocation)

2条回答
手持菜刀,她持情操
2楼-- · 2019-07-31 17:47

The issue is likely that you are trying to link a static archive that was built against the OS X SDK into your iOS Simulator executable. Previous versions of Xcode's toolchain did not guard against this (which can lead to various runtime issues where there are binary incompatibilities between the two platforms).

Your clock$UNIX2003 implementation hack is simply masking the larger issue.

You need to get a version of that library built against the iOS Simulator SDK for use in the iOS Simulator.

查看更多
走好不送
3楼-- · 2019-07-31 17:48

I finally Found a work around ! form this post : http://forum.unity3d.com/threads/ios8-xcode6-compatibility.249533/page-2

just add this code to the end of main.mm in Xcode project

#include <time.h>

extern "C"
{
clock_t
clock$UNIX2003(void)
{
    return clock();
}
}
查看更多
登录 后发表回答