clang use ld command to make the final link, I checked the manual and found -U
and -undefined
can 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.