gpt4 book ai didi

iphone - 静态库依赖项在 Xcode 3.2.3 上的模拟器中编译,在设备上失败

转载 作者:行者123 更新时间:2023-12-03 21:22:48 24 4
gpt4 key购买 nike

升级到 XCode 3.2.3 和 iPhone 3.2/4.0 SDK 在我的构建过程中引入了一个奇怪的错误。

我有一个静态库 Compton,它本身依赖于 Three20。我将 Compton 构建为它所支持的客户端应用程序的依赖项。

当我在模拟器或设备模式、3.2 或 4.0 SDK 中将 Compton 编译为其自己的项目时,一切都编译良好,没有错误。

当我使用 3.2 或 4.0 SDK、模拟器编译引用 Compton 的客户端应用程序(针对 3.2 上的 iPhone 或 iPhone/iPad)时,一切正常,没有编译错误,并且应用程序在模拟器中按预期运行。

当我编译完全相同的项目时,除了从模拟器到设备的build设置之外,没有任何更改,但是,我收到以下链接错误,在使用 #import 语句数小时后,我似乎无法消除这些错误、搜索路径、build设置等。我真正感到沮丧的部分是模拟器版本构建和运行良好,这似乎是一个很小的配置问题。我将错误粘贴在下面,从在设备模式下构建我的项目的角度来看,康普顿类似乎无法“看到”一些 Three20 header 。

我使用的是 Three20 的主干版本,今天拉出来的。

这是链接错误的输出:

Ld build/NewBlankComptonTemplate.build/Debug-iphoneos/NewBlankComptonTemplate.build/Objects-normal/armv7/NewBlankComptonTemplate normal armv7
cd /Users/wiley/iphone_projects/ComptonQuizzes/NewBlankComptonTemplate
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -L/Users/wiley/iphone_projects/ComptonQuizzes/NewBlankComptonTemplate/build/Debug-iphoneos -F/Users/wiley/iphone_projects/ComptonQuizzes/NewBlankComptonTemplate/build/Debug-iphoneos -filelist /Users/wiley/iphone_projects/ComptonQuizzes/NewBlankComptonTemplate/build/NewBlankComptonTemplate.build/Debug-iphoneos/NewBlankComptonTemplate.build/Objects-normal/armv7/NewBlankComptonTemplate.LinkFileList -dead_strip -ObjC -miphoneos-version-min=4.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework AudioToolbox -framework AVFoundation -framework CFNetwork -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework QuartzCore -framework StoreKit -framework SystemConfiguration -lxml2 -lz.1.2.3 /Users/wiley/iphone_projects/ComptonQuizzes/libs/Compton/src/build/Debug-iphoneos/libCompton.a -o /Users/wiley/iphone_projects/ComptonQuizzes/NewBlankComptonTemplate/build/NewBlankComptonTemplate.build/Debug-iphoneos/NewBlankComptonTemplate.build/Objects-normal/armv7/NewBlankComptonTemplate

Undefined symbols:
"_OBJC_CLASS_$_TTStyleSheet", referenced from:
objc-class-ref-to-TTStyleSheet in AppDelegate.o
"_OBJC_CLASS_$_TTURLAction", referenced from:
objc-class-ref-to-TTURLAction in AppDelegate.o
"_OBJC_CLASS_$_TTRoundedRectangleShape", referenced from:
objc-class-ref-to-TTRoundedRectangleShape in libCompton.a(ComptonStyleSheet.o)
"_OBJC_METACLASS_$_TTDefaultStyleSheet", referenced from:
_OBJC_METACLASS_$_ComptonStyleSheet in libCompton.a(ComptonStyleSheet.o)
"_OBJC_CLASS_$_TTView", referenced from:
objc-class-ref-to-TTView in libCompton.a(ComptonQuizStartController.o)
"_OBJC_CLASS_$_TTShapeStyle", referenced from:
objc-class-ref-to-TTShapeStyle in libCompton.a(ComptonQuizStartController.o)
"_OBJC_CLASS_$_TTInnerShadowStyle", referenced from:
objc-class-ref-to-TTInnerShadowStyle in libCompton.a(ComptonQuizStartController.o)
"_OBJC_METACLASS_$_TTViewController", referenced from:
_OBJC_METACLASS_$_ComptonFeedbackController in libCompton.a(ComptonFeedbackController.o)
_OBJC_METACLASS_$_ComptonCatalogController in libCompton.a(ComptonCatalogController.o)
_OBJC_METACLASS_$_ComptonQuizStartController in libCompton.a(ComptonQuizStartController.o)
_OBJC_METACLASS_$_PILAppAdViewController in libCompton.a(PILAppAdViewController.o)
_OBJC_METACLASS_$_ComptonQuizController in libCompton.a(ComptonQuizController.o)
"_OBJC_CLASS_$_TTURLCache", referenced from:
objc-class-ref-to-TTURLCache in libCompton.a(ComptonFeedbackController.o)
"_OBJC_CLASS_$_TTSolidBorderStyle", referenced from:
objc-class-ref-to-TTSolidBorderStyle in libCompton.a(ComptonQuizStartController.o)
"_OBJC_CLASS_$_TTViewController", referenced from:
_OBJC_CLASS_$_ComptonFeedbackController in libCompton.a(ComptonFeedbackController.o)
_OBJC_CLASS_$_ComptonCatalogController in libCompton.a(ComptonCatalogController.o)
_OBJC_CLASS_$_ComptonQuizStartController in libCompton.a(ComptonQuizStartController.o)
_OBJC_CLASS_$_PILAppAdViewController in libCompton.a(PILAppAdViewController.o)
_OBJC_CLASS_$_ComptonQuizController in libCompton.a(ComptonQuizController.o)
"_OBJC_CLASS_$_TTNavigator", referenced from:
objc-class-ref-to-TTNavigator in AppDelegate.o
"_OBJC_CLASS_$_TTPostController", referenced from:
objc-class-ref-to-TTPostController in libCompton.a(ComptonFeedbackController.o)
"_OBJC_CLASS_$_TTRoundedRightArrowShape", referenced from:
objc-class-ref-to-TTRoundedRightArrowShape in libCompton.a(ComptonStyleSheet.o)
"_OBJC_CLASS_$_TTButton", referenced from:
objc-class-ref-to-TTButton in libCompton.a(ComptonFeedbackController.o)
"_OBJC_CLASS_$_TTSolidFillStyle", referenced from:
objc-class-ref-to-TTSolidFillStyle in libCompton.a(ComptonQuizStartController.o)
"_OBJC_CLASS_$_TTWebController", referenced from:
objc-class-ref-to-TTWebController in AppDelegate.o
"_TTScreenBounds", referenced from:
-[ComptonCatalogController viewDidLoad] in libCompton.a(ComptonCatalogController.o)
-[PILAppAdViewController viewDidLoad] in libCompton.a(PILAppAdViewController.o)
"_OBJC_CLASS_$_TTDefaultStyleSheet", referenced from:
_OBJC_CLASS_$_ComptonStyleSheet in libCompton.a(ComptonStyleSheet.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status

谁能帮我弄清楚这里可能出了什么问题吗?

更新:我通过使用 Three20 和 process described here 的分支消除了重复的符号链接(symbolic link)错误。并删除 Three20 和 Compton 上的 -all_load 链接器标志。我遇到的真正疯狂的问题仍然存在:我可以在模拟器中很好地编译和运行应用程序,但是在为设备进行编译时,我收到上述链接错误。

更新 2:我已经解决了该问题,添加了答案并接受了它。问题确实是构建配置设置 - 如果您使用 4.0 SDK,则需要将“Architectures”设置为“Optimized (armv7)”。

最佳答案

据我所知,您构建了 libCompton,同时直接喜欢了 Three20,这只会导致 hell 。将静态库链接在一起并尝试在最终项目中使用它不会很有趣。也将 Three20 链接到您的应用程序,它应该可以解决您的问题,compton 应该只需要 header 才能编译,它只需要这些符号出现在您的应用程序的最终链接中。

关于iphone - 静态库依赖项在 Xcode 3.2.3 上的模拟器中编译,在设备上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3206999/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com