Hi,
I want bullet in my android native activity app but can't link it.
1) I download bullet3-2.83.4 src;
2) make toolchain for crosscompiling bullet for android
3) cmake bullet
4) make bullet with android toolchain (successfull)
5) write bullet hello world example
6) but here i can't link libBulletDynamics, libBulletCollision, libLinearMath. I have many undefined reference errors
( for example /home/freeman/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/TestLab/main.o: in function btSphereShape::btSphereShape(float):../GeneralLibs/bullet/android/include/bullet/BulletCollision/CollisionShapes/btSphereShape.h:29: error: undefined reference to 'btConvexInternalShape::btConvexInternalShape()')
So my Android.mk looks like this:
////////////////////////////////////////////////////////////////////////////////////////////
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := TestLab
FILE_LIST := $(wildcard $(LOCAL_PATH)/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_CFLAGS += -DANDROID
LOCAL_C_INCLUDES += ../GeneralLibs/glm
LOCAL_C_INCLUDES += ../GeneralLibs/bullet/android/include/bullet
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv2
LOCAL_STATIC_LIBRARIES := android_native_app_glue Something bulletDynamics bulletCollision bulletLinearMath
include $(BUILD_SHARED_LIBRARY)
$(call import-module,Something)
$(call import-module,GeneralLibs/bulletDynamics)
$(call import-module,GeneralLibs/bulletCollision)
$(call import-module,GeneralLibs/bulletLinearMath)
$(call import-module,android/native_app_glue)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In directory GeneralLibs there are all my libs and here i create separate directories for bulletDynamics, bulletCollision, bulletLinearMath in this directories i copy/paste
according static libs after bullet building. And in this directories i create Android.mk files with modules:
in directory bulletDynamics
//////////////////////////////////////
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := bulletDynamics
LOCAL_SRC_FILES := android/lib/libBulletDynamics.a
LOCAL_STATIC_LIBRARIES := bulletCollision bulletLinearMath
include $(PREBUILT_STATIC_LIBRARY)
$(call import-module,GeneralLibs/bulletCollision)
$(call import-module,GeneralLibs/bulletLinearMath)
////////////////////////////////////////
in directory bulletCollision
//////////////////////////////////////
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := bulletCollision
LOCAL_SRC_FILES := android/lib/libBulletCollision.a
LOCAL_STATIC_LIBRARIES := bulletLinearMath
include $(PREBUILT_STATIC_LIBRARY)
$(call import-module,GeneralLibs/bulletLinearMath)
////////////////////////////////////////
and in bulletLinearMath
///////////////////////////////////////////
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := bulletLinearMath
LOCAL_SRC_FILES := android/lib/libLinearMath.a
include $(PREBUILT_STATIC_LIBRARY)
////////////////////////////////////////////////////////////
I try different order of this libs but have always errors.
Anybody built bullet for android? Explain please how to link it.