Hello everybody.
Just wanted to warn that my skill in English is not very good, since it is not my native language. I have a problem with trying to run a test example using SDL2, SDL2_image, libjpeg libraries.
I used the latest snapshot of SDL2, specifically version SDL_2.0.8_11785.
Version of SDL2_images - SLD2_image_2.0.2
Version of libjpeg - libjpeg-9b
When building libraries, the following changes were made to the Android.mk files:
The following code was added to the Android.mk of the SLD2_image project:
include $ (CLEAR_VARS)
SDL2_HOME_DIR: = PathToSDL2\SDL_2.0.8_11785
LOCAL_MODULE: = SDL2
LOCAL_SRC_FILES: = $ (SDL2_HOME_DIR) \ libs \ $ (TARGET_ARCH_ABI) \ libSDL2.so
LOCAL_EXPORT_C_INCLUDES: = $ (SDL2_HOME_DIR) \ include
include $ (PREBUILT_SHARED_LIBRARY)
ifeq ($ (SUPPORT_JPG), true)
LOCAL_C_INCLUDES + = $ (LOCAL_PATH) / $ (JPG_LIBRARY_PATH)
LOCAL_CFLAGS + = -DLOAD_JPG
LOCAL_SHARED_LIBRARIES + = jpeg
endif
So I build three shared libraries with the necessary dependencies.
Below is the output of objdump program:
Dynamic Section:
PLTGOT 0x00014db4
PLTRELSZ 0x00000480
JMPREL 0x00001da0
PLTREL 0x00000011
REL 0x00001b78
RELSZ 0x00000228
RELENT 0x00000008
RELCOUNT 0x00000022
SYMTAB 0x000001f0
SYMENT 0x00000010
STRTAB 0x00000c60
STRSZ 0x000008bc
HASH 0x0000151c
NEEDED libSDL2.so
NEEDED libjpeg.so
NEEDED libc.so
NEEDED libm.so
NEEDED libstdc++.so
NEEDED libdl.so
SONAME libSDL2_image.so
Calling the IMG_Init () function of the form:
int flag = IMG_INIT_JPG;
if (IMG_Init (flag)! = flag) {
ALOGD ("JPG init not success");
} else {
ALOGD ("JPG init success");
}
says a successful initialization, but in the end, when you try to create a SDL_Surface in code like:
SDL_Surface * img_s = NULL;
img_s = IMG_Load ("foo.jpg");
Check of this type:
if (img == NULL) {
ALOGD ("% s", IMG_GetError ());
}
returns “JPEG loading error”
Maybe I’m doing something wrong, help me figure it out.