hi, I'm again trying to use Skia as a static library in my android app.
I checked out revision 8363, successfully build static libraries using:
android_make -d arm -j2 BUILDTYPE=Release
Then I package the static libs located in
/trunk/out/config/android-arm/Release, using "merge_static_libs.py"
found in trunk/tools.
In particular I'm adding:
libskia_core.a
libskia_ports.a
libskia_opts.a
libskia_images.a
libskia_effects.a
libskia_utils.a
libskia_skgr.a
libskia_gr.a
libskia_xml.a
libfreetype.a
obj.target/gyp/libexpat.a
Then I add the library (libskia_custom.a) to my
android.mk file, as a
prebuilt module, like this:
SKIA_FLAGS := -DSK_BUILD_FOR_ANDROID -DSK_BUILD_FOR_ANDROID_NDK \
-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 \
-DSK_SCALAR_IS_FLOAT -DSK_CAN_USE_FLOAT \
-DSK_USE_POSIX_THREADS \
-DSK_GAMMA_SRGB -DSK_GAMMA_APPLY_TO_A8\
-DSK_SUPPORT_GPU=1 -DGR_ANDROID_BUILD=1 \
-DSK_RELEASE -DGR_RELEASE=1 -DNDEBUG
SKIA_INCLUDES := $(SKIA_DIR)/include/gpu $(SKIA_DIR)/include/core \
$(SKIA_DIR)/include/effects
$(SKIA_DIR)/include/utils \
$(SKIA_DIR)/include/pipe
$(SKIA_DIR)/include/config \
$(SKIA_DIR)/include/images
$(SKIA_DIR)/include/lazy
include $(CLEAR_VARS)
LOCAL_PATH := $(SKIA_LOCAL_PATH)
LOCAL_MODULE := skiacustom_static
LOCAL_SRC_FILES := libskia_custom.a
LOCAL_LDLIBS := -lGLESv2 -lEGL
LOCAL_EXPORT_CFLAGS := $(SKIA_FLAGS)
LOCAL_EXPORT_C_INCLUDES := $(SKIA_INCLUDES)
include $(PREBUILT_STATIC_LIBRARY)
And then I list it as a dependency in my native module:
LOCAL_LDLIBS := -llog -lGLESv2 -lEGL -lOpenSLES -lm -landroid
LOCAL_STATIC_LIBRARIES += skiacustom_static
But I'm getting some undefined references, listed here:
/Users/athos/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi/libskia_custom.a(GrGLCreateNativeInterface_android.o):
in function
GrGLCreateNativeInterface():GrGLCreateNativeInterface_android.cpp(.text+0x640):
error: undefined reference to 'glBindVertexArrayOES'
/Users/athos/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi/libskia_custom.a(GrGLCreateNativeInterface_android.o):
in function
GrGLCreateNativeInterface():GrGLCreateNativeInterface_android.cpp(.text+0x688):
error: undefined reference to 'glDeleteVertexArraysOES'
/Users/athos/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi/libskia_custom.a(GrGLCreateNativeInterface_android.o):
in function
GrGLCreateNativeInterface():GrGLCreateNativeInterface_android.cpp(.text+0x6bc):
error: undefined reference to 'glGenVertexArraysOES'
/Users/athos/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi/libskia_custom.a(GrGLCreateNativeInterface_android.o):
in function
GrGLCreateNativeInterface():GrGLCreateNativeInterface_android.cpp(.text+0x7a0):
error: undefined reference to 'glFramebufferTexture2DMultisampleIMG'
/Users/athos/Documents/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi/libskia_custom.a(GrGLCreateNativeInterface_android.o):
in function
GrGLCreateNativeInterface():GrGLCreateNativeInterface_android.cpp(.text+0x7a4):
error: undefined reference to 'glRenderbufferStorageMultisampleIMG'
I believe these are related to OpenGL, as they are declared in gl2ext.h,
but since I included -lGLESv2 I thought I would be "covered". Did this
happen to anyone? Do you have any suggestion?
Thanks,
athos