I am making a library that I aim to use in both android and windows. For windows, using Visual Studio 2010, it compiles, links and runs fine.
For Android, I am using the ndk-build script with android-ndk-r7 (which uses gcc 4.4.3). I am getting several of these linker errors:
./obj/local/armeabi-v7a/libjonsengine.a(RenderManagerImpl.o):(.data.rel.ro._ZTI1
4IRenderManager[typeinfo for IRenderManager]+0x0): undefined reference to `vtabl
e for __cxxabiv1::__si_class_type_info'
./obj/local/armeabi-v7a/libjonsengine.a(RenderManagerImpl.o):(.data.rel.ro._ZTI1
2IBaseManager[typeinfo for IBaseManager]+0x0): undefined reference to `vtable fo
r __cxxabiv1::__class_type_info'
./obj/local/armeabi-v7a/libjonsengine.a(RenderManagerImpl.o):(.data.rel.ro+0x34)
: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
./obj/local/armeabi-v7a/libjonsengine.a(LogManagerImpl.o):(.data.rel.ro._ZTI11IL
ogManager[typeinfo for ILogManager]+0x0): undefined reference to `vtable for __c
xxabiv1::__si_class_type_info'
./obj/local/armeabi-v7a/libjonsengine.a(LogManagerImpl.o):(.data.rel.ro+0x38): u
ndefined reference to `vtable for __cxxabiv1::__si_class_type_info'
./obj/local/armeabi-v7a/libjonsengine.a(MemoryManagerImpl.o):(.data.rel.ro._ZTI1
4IMemoryManager[typeinfo for IMemoryManager]+0x0): undefined reference to `vtabl
e for __cxxabiv1::__si_class_type_info'
./obj/local/armeabi-v7a/libjonsengine.a(MemoryManagerImpl.o):(.data.rel.ro+0x40)
: undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libandroidgame.so] Error 1
Here is my Android.mk:
LOCAL_PATH:= $(call my-dir)
TOP_PATH := $(LOCAL_PATH)
include $(CLEAR_VARS)
# Main engine
LOCAL_MODULE := jonsengine
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include/ \
$(LOCAL_PATH)/../include/Core/ \
$(LOCAL_PATH)/../interface/ \
$(LOCAL_PATH)/../include/Render/ \
$(LOCAL_PATH)/../include/Utils/ \
$(LOCAL_PATH)/../include/Memory/
# Core
LOCAL_SRC_FILES := ../src/Core/Engine.cpp
# Rendering
LOCAL_SRC_FILES += ../src/Render/RenderManagerImpl.cpp
# Utils
LOCAL_SRC_FILES += ../src/Utils/LogManagerImpl.cpp \
../src/Utils/PortableTime.cpp
# Memory
LOCAL_SRC_FILES += ../src/Memory/MemoryManagerImpl.cpp \
../src/Memory/MemoryPool.cpp \
../src/Memory/dlmalloc.c
LOCAL_CFLAGS := -DSTRUCT_MALLINFO_DECLARED
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_EXPORT_CFLAGS := $(LOCAL_CFLAGS)
LOCAL_LDLIBS := -lGLESv2 -llog
include $(BUILD_STATIC_LIBRARY)
# Testing library
include $(CLEAR_VARS)
LOCAL_MODULE := jonsenginetests
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../Tests/ \
$(LOCAL_PATH)/../Tests/Memory/ \
$(LOCAL_PATH)/../Tests/Core/
LOCAL_SRC_FILES := ../Tests/TestManager.cpp \
../Tests/Memory/MemoryManagerTest.cpp \
../Tests/TestClass1.cpp
LOCAL_CFLAGS :=
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_EXPORT_CFLAGS := $(LOCAL_CFLAGS)
LOCAL_STATIC_LIBRARIES := jonsengine
LOCAL_LDLIBS :=-llog
include $(BUILD_STATIC_LIBRARY)
I can't divine the meaning nor the cause of that error. Anyone can shed some light on this? As I mentioned it works fine with VC++.
EDIT2:
Updated the error log. Does that help anything?
When I use "nm RenderManagerImpl.o" I get 'V' symbols and "00000000" addresses for '_ZTI4IRenderManager' for example.
EDIT3: It seems if I make jonsenginetests into a shared library rather than static it compiles. What does that imply?
Thanks