简体   繁体   English

iPhone应用程序上的Xcode链接器错误(仅在模拟器上)

[英]Xcode linker error on iPhone app (Only on simulator)

Im getting this linker error that won't let me compile. 我收到此链接器错误,无法编译。 It only happens on the simulator. 它仅在模拟器上发生。

KEY POINTS: 关键点:
- Happens only in simulator -仅在模拟器中发生
- Similar to THIS question , but found no FRAMEWORK_SEARCH_PATHS in my .pbxproj file -与这个问题类似,但在我的.pbxproj文件中没有找到FRAMEWORK_SEARCH_PATHS
- Though my OS is 10.6.2, I had to build target 1.5 to avoid other linker errors -尽管我的操作系统是10.6.2,但我必须构建目标1.5以避免其他链接器错误
- libxml2.dylib IS required and is in my Frameworks group -libxml2.dylib 必需的,位于我的Frameworks组中
- The other cited libraries I have never heard of. -我从未听说过的其他引用的库。
- Tried bringing in those other Libs under frameworks, didn't solve. -尝试将其他Libs引入框架下,但没有解决。


Build SpaceTweet of project SpaceTweet with configuration Debug

Ld build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet normal i386
cd "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)"
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -L/Users/Scott/Desktop "-L/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/../../libYAJLIPhone-0" -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk/usr/lib -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib "-F/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator" -filelist "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/SpaceTweet.build/Debug-iphonesimulator/SpaceTweet.build/Objects-normal/i386/SpaceTweet.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AVFoundation -framework MessageUI -lYAJLIPhone -lxml2 -o "/Users/Scott/Desktop/iPhone Dev/SpaceTweet(Experimental)/build/Debug-iphonesimulator/SpaceTweet.app/SpaceTweet"

ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libxml2.dylib, missing required architecture i386 in file
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib/libobjc.A.dylib, missing required architecture i386 in file
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1



CLUE: 线索:
Again, MY question is very similar to THIS SOLVED QUESTION except that in my case I did NOT find a FRAMEWORK_SEARCH_PATHS entry in the .pbxproj file in my project bundle and thus could not solve in the manner in which that question was solved. 同样,我的问题与问题非常相似,除了在我的情况下,我没有在项目包的.pbxproj文件中找到FRAMEWORK_SEARCH_PATHS条目,因此无法以解决问题的方式解决。

The problem is this: 问题是这样的:

-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib 

That's telling your Simulator (i386) build to use files from the Device (arm) /usr/lib. 这告诉您的Simulator(i386)版本使用Device(arm)/ usr / lib中的文件。

Find in your target where /usr/lib is (just use the Search bubble in the target's Get Info / Build Settings tab) and delete it. 在目标中找到/ usr / lib的位置(只需使用目标的“获取信息/构建设置”选项卡中的“搜索”气泡)并将其删除。 The compiler will use the correct platform's usr/lib if it's not told to use the wrong one first. 如果未告知编译器首先使用错误的平台,则编译器将使用正确平台的usr / lib。

I have the same issue. 我有同样的问题。 And it turns out to run my release version code on debug environment. 事实证明,可以在调试环境中运行我的发行版本代码。 Click "Edit schema..." and change Build Configuration to Release solved my problem. 单击“编辑架构...”,然后将“生成配置”更改为“发行”,解决了我的问题。

I had the same thing happen to me. 我也发生了同样的事情。 I deleted and re added all my frameworks and still had the same issue. 我删除并重新添加了所有框架,但仍然遇到相同的问题。 To get rid of the error finally I had to delete the path pointing to the offending library from Library Search Paths under build settings. 为了消除错误,最后我不得不从构建设置下的“库搜索路径”中删除指向有问题的库的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM