Clang: Undefined symbols, but it is there using nm.

https://stackoverflow.com/questions/36662920/xcode-clang-link-build-dynamic-framework-or-dylib-not-embed-dependencies

 

clang use ld command to make the final link, I checked the manual and found -U and -undefinedcan ignore undefined symbols.

-U symbol_name 

Specified that it is ok for symbol_name to have no definition. With two_levelnamespace, the resulting symbol will be marked dynamic_lookup which means dyld will search all loaded images.

-undefined treatment

Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The default is error.

So the final solution is set -Wl,-undefined,dynamic_lookup to OTHER_LDFLAGS, also make sure search path set correctly. It works.

 

posted @ 2016-12-14 15:42  lilei9110  阅读(305)  评论(0编辑  收藏  举报