I’m not sure if this is a cocos2d-x issue (it might be Android NDK-related) but it can be useful to discuss it here in case someone else faces it. I’m using NDK-r5 and cocos2d-x 0.7.2.
So cocos2d-x comes with two tests project, “helloworld” and “test”. This tests are based on additional modules (shared libraries) that are build along with the test project by issuing the ndk-build command. These libraries are Box2D, cocos2d and cocosdenshion.
So far so good. I started my project called “siege” and I was able to do the same - that is, use those shared libraries in my project (building them alongside my project).
Problems rised when I added another external module (shared library), “tinyXML”. I set up tinyXML as it has been done with Box2D, that is I put it in an external folder and I copied the Android.mk from Box2D, then modified it to my needs (i.e. replace name of source file and module name).
Now my project won’t build because no matter what I set in my project’s Android.mk, it builds box2d, cocos2d, cocosdenshion, my project (“siege”) and then tinyXML. The order is important! It fails while building my project because tinyXML is not built yet.
I tried using various definition in my project Android.mk, including (I list all the alternatives I tried):
LOCAL_SHARED_LIBRARIES += tinyXML
LOCAL_ADDITIONAL_DEPENDENCIES += libtinyxml
LOCAL_REQUIRED_MODULES += libtinyxml
LOCAL_SHARED_LIBRARIES := tinyXML (and so on, using := instead of +=)
LOCAL_SHARED_LIBRARIES := libtinyxml (and so on, using libtinyxml instead of tinyxml)
none of this seems to fix the build order. It seems to me that the build is performed in alphabetical order. Box2d, cocos2d, cocosdenshion, siege, tinyxml, no matter what you specify as dependences.
To investigate this, I renamed tinyxml to aaatinyxml and it’s building like a charm, as it’s build first. Anyone experiencing the same problem? Am I missing some definitions that specify the order of the build?
I believe the test projects shipped with cocos2d-x might be liable to the same problem - it might be a coincidence that Helloworld and Test (H and T) come after B and C so the build order is correct. What happen if you change HelloWorld to aaaHelloWorld? (I’m too la…. busy to try myself )