I’m building a dynamic framework for iOS. It needs reference some symbols from code or other libraries, but I not want link them into the framework.
This can be achieved when build an static library, just setup search path and make sure them not included in target’s build phases.
But when build a dynamic framework or dylib, this result undefined symbol error. I tried all kinds of link options, eg -l
-weak_library
-weak_framework
-I
-rpath
-rpath-link
. But none works.
The link command looks like this:
clang -arch x86_64 -dynamiclib
-isysroot *iPhone_SDK_PATH*
*OPTIONS_NOT_IMPORTANT*
-install_name @rpath/Foo.framework/Foo
-Xlinker -rpath -Xlinker @executable_path/Frameworks
-Xlinker -rpath -Xlinker @loader_path/Frameworks
-Xlinker -rpath -Xlinker *BUILD_PATH*
-mios-simulator-version-min=7.0
-Xlinker -no_deduplicate
-Xlinker -objc_abi_version
-Xlinker 2
-fobjc-arc -fobjc-link-runtime
-framework Foundation
-single_module
-compatibility_version 1
-current_version 1
-Xlinker -dependency_info
-Xlinker *BUILD_PATH*/Foo.build/Objects-normal/x86_64/Foo_dependency_info.dat
-o *BUILD_PATH*/Foo.framework/Foo