构建时 Xcode 4(最终版本)错误 [英] Xcode 4 (final version) error when building
问题描述
我似乎找不到答案.
我刚刚使用了 Xcode 4 最终版本并构建了一个使用 Xcode 3 构建正常的现有项目,但出现此错误:
I've just used Xcode 4 final version and built an existing project that was built ok with Xcode 3, but got this error:
ld: library not found for -lSystem.B
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
但是使用 Xcode 4 构建了另一个项目.
But another project was built OK with Xcode 4.
我通过选择默认选项安装了 Xcode 4.
I installed Xcode 4 by choosing the default options.
我是否想在某处包含库或框架?
Do I miss to include a library or framework somewhere?
有人可以帮忙吗?谢谢.
Could somebody please help. Thank you.
推荐答案
这是我针对 Xcode 4.0.2 和 SDK 4.3 环境的解决方案,但我相信它也适用于其他设置.
Here's my solution for Xcode 4.0.2 with SDK 4.3 environment, but I believe it should also work on other setups.
libSystem.B.dylib
不存在在下面/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib
,但是它存在于较低的 SDK版本(例如iPhoneOS4.2.sdk
)- 大多数情况
libSystem.B.dylib
只是一个libSystem.dylib
的符号链接 - 所以在
iPhoneSimulator4.3.sdk/usr/lib
我已经应用了以下命令sudoln -s libSystem.dyliblibSystem.B.dylib
和我的模拟器构建再次开始工作:)
libSystem.B.dylib
is not present under/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib
, however it is present for lower SDK versions (e.g.iPhoneOS4.2.sdk
)- most of the cases
libSystem.B.dylib
is just a symbolic link tolibSystem.dylib
- so in
iPhoneSimulator4.3.sdk/usr/lib
I've applied following commandsudo ln -s libSystem.dylib libSystem.B.dylib
and my simulator builds started to work again :)
注意: libSystem.B.dylib
被 Flurry 和 Urban Airship 使用,所以你最好不要删除项目文件中的引用(当然 Urban Airship 没有在模拟器下工作,但我认为 Flurry 可以.libSystem.B.dylib
也可能是您项目中包含的其他库所需要的.
NOTE: libSystem.B.dylib
is used by Flurry and Urban Airship so you better don't delete the reference in project file (of course Urban Airship does not work under Simulator, but I think Flurry does. libSystem.B.dylib
may also be required by other libraries you included to your project.
更新:升级到 Xcode 4.3 后解决方案仍然适用于 iOS5 Simulator
UPDATE: solution still works for iOS5 Simulator after upgrading to Xcode 4.3
更新,2k12 年 3 月 9 日:对于通过 App Store 安装的 Xcode,在路径上方加上 /Applications/Xcode.app/Contents
或您安装的路径的前缀已安装 Xcode.app.
UPDATE, March 9th, 2k12: for Xcode installations via App Store, prefix above path with /Applications/Xcode.app/Contents
or the path where you've installed Xcode.app.
这篇关于构建时 Xcode 4(最终版本)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!