查看单个帖子
旧 2009-05-06, 04:46 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】library linking errors in xcode 1.5

library linking errors in xcode 1.5
library linking errors in xcode 1.5
i am trying to use/link to the latest dwg direct libraries in my software product. i am getting either 'undefined' or 'multiply defined' symbol errors in the library linking step of the compile process.
to diagnose the problem i returned to the "dd_nonlibsmac/examples/odreadex" example which i ported/built in xcode. it compiles and runs when using the 'zerolink' xcode option for development software.
i am seeing the same 'undefined' library linking errors in odreadex when not using the 'zerolink" compiler flag. i get error reports of undefined symbols, such as in the odreadex example.
ld: warning prebinding disabled because of undefined symbols
ld: undefined symbols:
odbrentity::~odbrentity()
odbrtraverser::~odbrtraverser()
odacisrendererimpl:dacisrendererimpl()
odbrbrepfacetraverser::setbrep(odbrbrep const&)
odbrbrepfacetraverser:dbrbrepfacetraverser()
....
the "odacisrendererimpl" only seems to be contained in the 'libdd_macosx_acisrenderer.a' and 'libdd_macosx_modelergeometry.a' files, and both of them are linked into the project build!!!
in the 'zerolink' mode of compiling, the project builds and runs properly.
tha main issue is, i cannot build my main/work project in 'zerolink'.
any ideas? i'm also consulting apple about this issue.
thanks in advance
michael
linking directdwg in xcode (mac os x)
hi,
i had similar (undefined symbols) problem when linking direct dwg libraries (dd libs) in xcode ide ("deployment" variant).
problem:
dd libraries can be linked with zerolink in "development" variant but failed to be linked with "ld" in "deployment" variant (a lot of "unresolved symbol" errors reported by "ld").
here is solution that worked for me:
1) rename all dd libraries to "lib<name.ext>". in other words, rename all dd_... libraries with prefix "lib", i.e. "dd_macosx_acisbuilder.a" to "libdd_macosx_acisbuilder.a". this is required by "ld" linking tool used by xcode for "deployment" builds.
2) build your project without dd libraries, naturally you'll get a lot of "undefined_symbol" errors at linking stage.
3) add "libdd..." library to resolve undefined symbols which are reported first. a little luck and guess work will be required to add proper libraries because sometimes it's not obvious which library exports required symbols.
4) build your project again. if you have added some library but same unresolved symbols are at the beginning of errors log, you should remove library from your project (xcode will do symbols lookup in libraries in the order of their addition to the project, rearranging libraries inside xcode project window will not change the order of "ld" command line and thus lookup order). repeat steps 3 and 4 until no "undefined symbol" errors left.
in my case i added following libraries one by one(in exact order):
libdd_macosx_db.a
libdd_macosx_alloc.a
libdd_macosx_root.a
libdd_macosx_ge.a
libdd_macosx_gi.a
libdd_macosx_ft.a
best regards and good luck with your projects,
yuriy litoshenko,
ecsat, kiev.
on behalf of fons de wolf.
adw software.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)