静态库依赖项在Xcode 3.2.3上的模拟器中编译,在设备上失败 [英] Static library dependency compiles in simulator on Xcode 3.2.3, fails on device

查看:86
本文介绍了静态库依赖项在Xcode 3.2.3上的模拟器中编译,在设备上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到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为目标,一切正常,没有编译错误,并且该应用程序在仿真器中按预期运行. /p>

当我编译完全相同的项目时,除了从模拟器到设备的构建设置外,什么都没有改变,但是,我收到以下链接错误,这些错误在弄乱了#import语句,搜索路径,构建设置几个小时后似乎无法消除等等.我真正感到沮丧的是,模拟器版本正在构建并运行良好,这似乎是一个很小的小配置问题.我在下面粘贴了错误,从在设备模式下构建项目的角度来看,康普顿类看起来像是看不到"这20个标头中的某些标头.

我使用的是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和

我现在已经解决了这个问题,答案在Apple开发人员论坛上得到了通过.如果将基本SDK设置为> 3.2,则需要将构建设置"中的架构"选项设置为优化"(armv7).

代码现在可以编译,并且可以在模拟器和设备上正常运行.

Upgrading to XCode 3.2.3 and iPhone 3.2/4.0 SDK has introduced a strange bug into my build process.

I have a static library, Compton, which itself depends on three20. I build Compton as a dependency of the client apps that it powers.

When I compile Compton as its own project in either simulator or device mode, 3.2 or 4.0 SDK, everything compiles fine, no errors.

When I compile a client app that references Compton using the 3.2 or 4.0 SDK, simulator, targeting the iPhone or iPhone / iPad on 3.2, everything works great, no compile errors, and the app runs as expected in the simulator.

When I compile the exact same project changing nothing except the build settings from simulator to device, however, I get the following linking errors that I cannot seem to banish after hours of messing with #import statements, search paths, build settings, etc. The part I'm really frustrated with is that the simulator versions are building and running fine, it seems like a tiny little config problem. I'm pasting the errors below, it looks like the Compton classes, from the perspective of building my project in device mode, can't "see" some of the three20 headers.

I'm using the trunk version of three20, pulled today.

Here is the output from the linking errors:

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

Can anyone help me figure out what may be going wrong here?

Update: I've eliminated the duplicate symbol linking error by using the fork of three20 and process described here and removing the -all_load linker flag on three20 and Compton. The really crazy problem that I'm stuck on remains: I can compile and run the app fine in the simulator, but when compiling for the device, I get the above linking errors.

Update 2: I've resolved the issue, added an answer and accepted it. The problem was indeed a build config setting - if you're using the 4.0 SDK, you need to set "Architectures" to "Optimized (armv7)".

解决方案

I've now resolved this issue, the answer came through on the Apple Developer Forums. If you set the base SDK to > 3.2, you need to set the "Architectures" option in Build settings to Optimized (armv7).

The code now compiles and just fine on the simulator and the device.

这篇关于静态库依赖项在Xcode 3.2.3上的模拟器中编译,在设备上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆