I have a collection of libfooi.a; libfoo1.a, libfoo2.a, libfoo3.a ..., which use factories (with static code), have a common interface for creating C ++ objects.
With CMake, I select one of them and create libfooWrapper.a that bind it and add all the content. Using CMake, this CMakeLists.txt works in Android:
PROJECT(fooWrapper) INCLUDE_DIRECTORIES(___) ADD_LIBRARY(fooWrapper SHARED ${SRC} ${HEADERS} )
A manually-executed executable application project, only linked fooWrapper generated and working.
But on iOS using Clang, I changed ADD_LIBRARY to STATIC and try using -Wl, the whole archive, but it doesn't work. I checked the documentation that using -Obj -Wl, -force_load should work. I also tried using the -Obj -Wl, -all_load flag.
By analyzing the libfooWrapper.a library with otool, it seems that all the content from libfooi.a has not been added to libfooWrapper.a, but I need to put it inside to avoid changing the flags manually in the executable application project.
What is wrong with the link?
source share