gavinkwoe / BeeFramework

[Experimental] A semi-hybrid framework that allows you to create mobile apps using Objective-C and XML/CSS
MIT License
3.33k stars 1.06k forks source link

编译static library时的问题 #128

Open e2ghost opened 9 years ago

e2ghost commented 9 years ago

我想将BeeFramework编译成静态库,在我的工程中直接引用(用dribble范例测试,删除原有的framework引用)。

编译成静态库(libBeeFramework.a)没有问题,但是在dribble中通过以下方式引用: Other Link Flag: -ObjC -lBeeFramework 配置Header Search Path和Library Search Path

之后在工程中出现以下提示,不知是否我的静态库工程配置有误还是dribble工程配置有误,望解答

Undefined symbols for architecture i386:
"_CGSizeAuto", referenced from:
_62-[ServiceLogger_Board handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in ServiceLogger_Board.o
_70-[DribbbleProfileBoard_iPhone handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in DribbbleProfileBoardiPhone.o
69-[DribbbleDetailBoard_iPhone handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in DribbbleDetailBoard_iPhone.o
_62-[ServiceLogger_Board handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in ServiceLoggerBoard.o
70-[DribbbleProfileBoard_iPhone handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in DribbbleProfileBoard_iPhone.o
_69-[DribbbleDetailBoard_iPhone handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in DribbbleDetailBoardiPhone.o
62-[ServiceLogger_Board handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in ServiceLogger_Board.o
_70-[DribbbleProfileBoard_iPhone handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in DribbbleProfileBoardiPhone.o
69-[DribbbleDetailBoard_iPhone handleUISignal_BeeUIBoard_CREATE_VIEWS:]_block_invoke in DribbbleDetailBoard_iPhone.o
"_OBJCCLASS$_BeeOnceViewModel", referenced from:
_OBJCCLASS$_ShotInfoModel in ShotInfoModel.o
"_OBJCCLASS$_BeeUIActionSheet", referenced from:
objc-class-ref in DribbbleDetailBoard_iPhone.o
"_OBJCCLASS$_BeeUIActivityIndicatorView", referenced from:
objc-class-ref in DribbbleWebBoard_iPhone.o
"_OBJCCLASS$_BeeUIApplication", referenced from:
objc-class-ref in ServiceInspector_Window.o
_OBJCCLASS$_AppDelegate in AppDelegate.o
objc-class-ref in ServicePush.o
objc-class-ref in ServiceInspector_WindowHook.o
objc-class-ref in ServiceShare_Window.o
objc-class-ref in ServiceInspector.o
objc-class-ref in libBeeFramework.a(Bee_Service.o)
...
"_OBJCCLASS$_BeeUIBoard", referenced from:
_OBJCCLASS$_ServiceWizard_Board in ServiceWizard_Board.o
objc-class-ref in ServiceDebugger_DashBoard.o
_OBJCCLASS$_ServiceDebugger_DashBoard in ServiceDebugger_DashBoard.o
lOBJC$_CATEGORYBeeUIBoard$_ServiceLiveloadPrivate in ServiceLiveload_Category.o
_OBJCCLASS$_ServiceLogger_Board in ServiceLogger_Board.o
_OBJCCLASS$_DribbbleWebBoard_iPhone in DribbbleWebBoard_iPhone.o
_OBJCCLASS$_DribbblePreviewBoard_iPhone in DribbblePreviewBoard_iPhone.o
...
"_OBJCCLASS$_BeeUIButton", referenced from:
objc-class-ref in ServiceInspector_Window.o
objc-class-ref in ServiceInspector_Dock.o
objc-class-ref in ServiceGridSystem_Dock.o
objc-class-ref in ServiceDebugger_Dock.o
objc-class-ref in ServiceLogger_Dock.o
"_OBJCCLASS$_BeeUICell", referenced from:
_OBJCCLASS$_ServiceDebugger_DashMessageCell in ServiceDebugger_DashMessageCell.o
_OBJCCLASS$_ServiceWizard_TemplateCell in ServiceWizard_TemplateCell.o
_OBJCCLASS$_DribbbleWebBoardTab_iPhone in DribbbleWebBoardTab_iPhone.o
_OBJCCLASS$_DribbbleDetailBoardPhoto_iPhone in DribbbleDetailBoardPhoto_iPhone.o
_OBJCCLASS$_ServiceLogger_Cell in ServiceLogger_Cell.o
_OBJCCLASS$_ServiceDebugger_DashMemoryCell in ServiceDebugger_DashMemoryCell.o
_OBJCCLASS$_DribbbleProfileBoardCell_iPhone in DribbbleProfileBoardCell_iPhone.o
...
"_OBJCCLASS$_BeeUIConfig", referenced from:
objc-class-ref in ServiceDebugger_DashBoard.o
objc-class-ref in ServiceShare_TencentWeibo_AuthorizeBoard.o
objc-class-ref in ServiceShare_SinaWeibo_AuthorizeBoard.o
objc-class-ref in ServiceShare_AuthorizeBoard.o
"_OBJCCLASS$_BeeUIFootLoader", referenced from:
_OBJCCLASS$_FootLoader in FootLoader.o
"_OBJCCLASS$_BeeUIImageView", referenced from:
_OBJCCLASS$_ServiceInspector_Layer in ServiceInspector_Window.o
_OBJCCLASS$_ServiceInspector_Indicator in ServiceInspector_Indicator.o
_OBJCCLASS$_ServiceInspector_Border in ServiceInspector_Border.o
_OBJCCLASS$_ServiceLiveload_Border in ServiceLiveload_Border.o
"_OBJCCLASS$_BeeUILabel", referenced from:
objc-class-ref in ServiceInspector_Window.o
_OBJCCLASS$_ServiceWireframeView in ServiceWireframeView.o
"_OBJCCLASS$_BeeUINavigationBar", referenced from:
objc-class-ref in AppDelegate.o
"_OBJCCLASS$_BeeUIPullLoader", referenced from:
_OBJCCLASS$_PullLoader in PullLoader.o
"_OBJCCLASS$_BeeUIRouter", referenced from:
objc-class-ref in DribbbleBoard_iPhone.o
"_OBJCCLASS$_BeeUIScrollView", referenced from:
objc-class-ref in ServiceDebugger_DashBoard.o
lOBJC$_CATEGORYBeeUIScrollView$_ServiceLiveloadPrivate in ServiceLiveload_Category.o
"_OBJCCLASS$_BeeUIStack", referenced from:
objc-class-ref in AppDelegate.o
"_OBJCCLASS$_BeeUIStyleManager", referenced from:
objc-class-ref in ServiceLiveload_Category.o
"_OBJCCLASS$_BeeUITemplateManager", referenced from:
objc-class-ref in ServiceLiveload_Hook.o
"_OBJCCLASS$_BeeUITemplateParser", referenced from:
objc-class-ref in ServiceWizard_Board.o
"_OBJCCLASS$_BeeUITemplateParserXML", referenced from:
objc-class-ref in ServiceDebugger.o
"_OBJCCLASS$_BeeUIWebView", referenced from:
objc-class-ref in DribbbleWebBoard_iPhone.o
"_OBJCCLASS$_BeeUIWindow", referenced from:
_OBJCCLASS$_ServiceInspector_Window in ServiceInspector_Window.o
_OBJCCLASS$_ServiceDebugger_StatusBar in ServiceDebugger_StatusBar.o
_OBJCCLASS$_ServiceInspector_Dock in ServiceInspector_Dock.o
_OBJCCLASS$_ServiceGridSystem_Dock in ServiceGridSystem_Dock.o
_OBJCCLASS$_ServiceGridSystem_Window in ServiceGridSystem_Window.o
_OBJCCLASS$_ServiceDebugger_Window in ServiceDebugger_Window.o
_OBJCCLASS$_ServiceWizard_Window in ServiceWizard_Window.o
...
"_OBJCCLASS$_BeeViewModel", referenced from:
_OBJCCLASS$_BeePagingViewModel in libBeeFramework.a(Bee_PagingViewModel.o)
_OBJCCLASS$_BeeStreamViewModel in libBeeFramework.a(Bee_StreamViewModel.o)
"_OBJCMETACLASS$_BeeOnceViewModel", referenced from:
_OBJCMETACLASS$_ShotInfoModel in ShotInfoModel.o
"_OBJCMETACLASS$_BeeUIApplication", referenced from:
_OBJCMETACLASS$_AppDelegate in AppDelegate.o
"_OBJCMETACLASS$_BeeUIBoard", referenced from:
_OBJCMETACLASS$_ServiceWizard_Board in ServiceWizard_Board.o
_OBJCMETACLASS$_ServiceDebugger_DashBoard in ServiceDebugger_DashBoard.o
_OBJCMETACLASS$_ServiceLogger_Board in ServiceLogger_Board.o
_OBJCMETACLASS$_DribbbleWebBoard_iPhone in DribbbleWebBoard_iPhone.o
_OBJCMETACLASS$_DribbblePreviewBoard_iPhone in DribbblePreviewBoard_iPhone.o
_OBJCMETACLASS$_ServiceShare_AuthorizeBoard in ServiceShare_AuthorizeBoard.o
_OBJCMETACLASS$_DribbbleBoard_iPhone in DribbbleBoard_iPhone.o
...
"_OBJCMETACLASS$_BeeUICell", referenced from:
_OBJCMETACLASS$_ServiceDebugger_DashMessageCell in ServiceDebugger_DashMessageCell.o
_OBJCMETACLASS$_ServiceWizard_TemplateCell in ServiceWizard_TemplateCell.o
_OBJCMETACLASS$_DribbbleWebBoardTab_iPhone in DribbbleWebBoardTab_iPhone.o
_OBJCMETACLASS$_DribbbleDetailBoardPhoto_iPhone in DribbbleDetailBoardPhoto_iPhone.o
_OBJCMETACLASS$_ServiceLogger_Cell in ServiceLogger_Cell.o
_OBJCMETACLASS$_ServiceDebugger_DashMemoryCell in ServiceDebugger_DashMemoryCell.o
_OBJCMETACLASS$_DribbbleProfileBoardCell_iPhone in DribbbleProfileBoardCell_iPhone.o
...
"_OBJCMETACLASS$_BeeUIFootLoader", referenced from:
_OBJCMETACLASS$_FootLoader in FootLoader.o
"_OBJCMETACLASS$_BeeUIImageView", referenced from:
_OBJCMETACLASS$_ServiceInspector_Layer in ServiceInspector_Window.o
_OBJCMETACLASS$_ServiceInspector_Indicator in ServiceInspector_Indicator.o
_OBJCMETACLASS$_ServiceInspector_Border in ServiceInspector_Border.o
_OBJCMETACLASS$_ServiceLiveload_Border in ServiceLiveload_Border.o
"_OBJCMETACLASS$_BeeUILabel", referenced from:
_OBJCMETACLASS$_ServiceWireframeView in ServiceWireframeView.o
"_OBJCMETACLASS$_BeeUIPullLoader", referenced from:
_OBJCMETACLASS$_PullLoader in PullLoader.o
"_OBJCMETACLASS$_BeeUIWindow", referenced from:
_OBJCMETACLASS$_ServiceInspector_Window in ServiceInspector_Window.o
_OBJCMETACLASS$_ServiceDebugger_StatusBar in ServiceDebugger_StatusBar.o
_OBJCMETACLASS$_ServiceInspector_Dock in ServiceInspector_Dock.o
_OBJCMETACLASS$_ServiceGridSystem_Dock in ServiceGridSystem_Dock.o
_OBJCMETACLASS$_ServiceGridSystem_Window in ServiceGridSystem_Window.o
_OBJCMETACLASS$_ServiceDebugger_Window in ServiceDebugger_Window.o
_OBJCMETACLASS$_ServiceWizard_Window in ServiceWizard_Window.o
...
"_OBJCMETACLASS$_BeeViewModel", referenced from:
_OBJCMETACLASS$_BeePagingViewModel in libBeeFramework.a(Bee_PagingViewModel.o)
_OBJCMETACLASS$_BeeStreamViewModel in libBeeFramework.a(BeeStreamViewModel.o)
"getQueryBlock", referenced from:
-[ServiceDebugger_DashMessageCell load] in ServiceDebugger_DashMessageCell.o
-[ServiceDebugger_DashMessageCell dataDidChanged] in ServiceDebugger_DashMessageCell.o
-[DribbbleDetailBoardPhoto_iPhone dataDidChanged] in DribbbleDetailBoardPhoto_iPhone.o
-[ServiceDebugger_DashMemoryCell load] in ServiceDebugger_DashMemoryCell.o
-[ServiceDebugger_DashMemoryCell dataDidChanged] in ServiceDebugger_DashMemoryCell.o
-[ServiceDebugger_DashCPUCell load] in ServiceDebugger_DashCPUCell.o
-[ServiceDebugger_DashCPUCell dataDidChanged] in ServiceDebugger_DashCPUCell.o
...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

michaelxxw commented 9 years ago

是不是需要打个通用二进制包?看看这个是否有帮助:http://www.cocoachina.com/industry/20131204/7468.html

e2ghost commented 9 years ago

制作静态库没问题,我已经制作好了,只是在范例工程里把framework的引用删除后,引入我制作的静态库进行编译才出的问题。

michaelxxw commented 9 years ago

我能想到的两个方面1.是否在Build Setting→Search Paths→Header Search Paths 里添加了静态库的路径 2.尝试关闭xcode,然后清除~/Library/Developer/Xcode/DerivedData/ 目录下项目相关的所有缓存,再重新编译。希望能帮到你~~

michaelxxw commented 9 years ago

另外,有没有用lipo -info 看一下你的静态库 是否支持i386?

e2ghost commented 9 years ago

谢谢解答,不过我有配置了Other Link Flag: -ObjC -lBeeFramework以及配置Header Search Path和Library Search Path,如果没有配置提示的会是其他类型的错误

我再检查一下有没有配置的问题吧,之前怀疑是architecture的问题,但好像又不是。