SDL 2.0.7
SDL2_image 2.0.2
I have successfully build for SDL2 libraries listed below:
C:\MySDK\libraries\SDL\libs>dir /s/b *.so
C:\MySDK\libraries\SDL\libs\arm64-v8a\libSDL2.so
C:\MySDK\libraries\SDL\libs\armeabi\libSDL2.so
C:\MySDK\libraries\SDL\libs\armeabi-v7a\libSDL2.so
C:\MySDK\libraries\SDL\libs\mips\libSDL2.so
C:\MySDK\libraries\SDL\libs\mips64\libSDL2.so
C:\MySDK\libraries\SDL\libs\x86\libSDL2.so
C:\MySDK\libraries\SDL\libs\x86_64\libSDL2.so
Now I try to build SDL2_image library. I have created symlink in my SDL2_image folder
mklink /D SDL2 C:\MySDK\libraries\SDL
I have rebult.bat file
call cls
set APP_PLATFORM=android-14
set NDK_PROJECT_PATH=%MY_SDK_HOME%\libraries\SDL_image
set APP_BUILD_SCRIPT=%NDK_PROJECT_PATH%\Android.mk
call %ANDROID_NDK_HOME%/ndk-build -e clean
call %ANDROID_NDK_HOME%/ndk-build -e
When I set ANDROID_NDK_HOME to android-ndk-r15c I get this error:
build/core/build-binary.mk:688: Android NDK: Module SDL2_image depends on undefined modules: SDL2
build/core/build-binary.mk:701: *** Android NDK: Aborting (set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies) . Stop.
build/core/build-binary.mk:688: Android NDK: Module SDL2_image depends on undefined modules: SDL2
build/core/build-binary.mk:701: *** Android NDK: Aborting (set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies) . Stop.
When I set ANDROID_NDK_HOME to android-ndk-r10c I get this error:
[armeabi] Compile thumb : SDL2_image <= IMG.c
In file included from C:\MySDK\libraries\SDL_image\/IMG.c:24:0:
C:\MySDK\libraries\SDL_image\/SDL_image.h:27:17: fatal error: SDL.h: No such file or directory
compilation terminated.
make.exe: *** [C:\MySDK\libraries\SDL_image/obj/local/armeabi/objs/SDL2_image/IMG.o] Error 1
What I’m doing wrong? How should I attach SDL2 module to SDL2_image?
Android.mk in SDL
LOCAL_PATH := $(call my-dir)
###########################
#
# SDL shared library
#
###########################
include $(CLEAR_VARS)
LOCAL_MODULE := SDL2
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_SRC_FILES := \
$(subst $(LOCAL_PATH)/,, \
$(wildcard $(LOCAL_PATH)/src/*.c) \
$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
$(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \
$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
$(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/events/*.c) \
$(wildcard $(LOCAL_PATH)/src/file/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
$(LOCAL_PATH)/src/joystick/steam/SDL_steamcontroller.c \
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
$(wildcard $(LOCAL_PATH)/src/power/*.c) \
$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/render/*.c) \
$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/test/*.c))
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
include $(BUILD_SHARED_LIBRARY)
###########################
#
# SDL static library
#
###########################
LOCAL_MODULE := SDL2_static
LOCAL_MODULE_FILENAME := libSDL2
LOCAL_LDLIBS :=
LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
include $(BUILD_STATIC_LIBRARY)
###########################
#
# SDL main static library
#
###########################
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_MODULE := SDL2_main
LOCAL_MODULE_FILENAME := libSDL2main
include $(BUILD_STATIC_LIBRARY)
Android.mk in SDL_image
MY_LOCAL_PATH := $(call my-dir)
# Enable this if you want to support loading JPEG images
# The library path should be a relative path to this directory.
SUPPORT_JPG ?= true
JPG_LIBRARY_PATH := external/jpeg-9b
# Enable this if you want to support loading PNG images
# The library path should be a relative path to this directory.
SUPPORT_PNG ?= true
PNG_LIBRARY_PATH := external/libpng-1.6.32
# Enable this if you want to support loading WebP images
# The library path should be a relative path to this directory.
SUPPORT_WEBP ?= true
WEBP_LIBRARY_PATH := external/libwebp-0.6.0
# Build the library
ifeq ($(SUPPORT_JPG),true)
include $(MY_LOCAL_PATH)/$(JPG_LIBRARY_PATH)/Android.mk
endif
# Build the library
ifeq ($(SUPPORT_PNG),true)
include $(MY_LOCAL_PATH)/$(PNG_LIBRARY_PATH)/Android.mk
endif
# Build the library
ifeq ($(SUPPORT_WEBP),true)
include $(MY_LOCAL_PATH)/$(WEBP_LIBRARY_PATH)/Android.mk
endif
# Restore local path
LOCAL_PATH := $(MY_LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := SDL2_image
LOCAL_SRC_FILES := \
IMG.c \
IMG_bmp.c \
IMG_gif.c \
IMG_jpg.c \
IMG_lbm.c \
IMG_pcx.c \
IMG_png.c \
IMG_pnm.c \
IMG_svg.c \
IMG_tga.c \
IMG_tif.c \
IMG_webp.c \
IMG_WIC.c \
IMG_xcf.c \
IMG_xpm.c.arm \
IMG_xv.c \
IMG_xxx.c
LOCAL_CFLAGS := -DLOAD_BMP -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM \
-DLOAD_SVG -DLOAD_TGA -DLOAD_XCF -DLOAD_XPM -DLOAD_XV
LOCAL_LDLIBS :=
LOCAL_STATIC_LIBRARIES :=
LOCAL_SHARED_LIBRARIES := SDL2
ifeq ($(SUPPORT_JPG),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(JPG_LIBRARY_PATH)
LOCAL_CFLAGS += -DLOAD_JPG
LOCAL_STATIC_LIBRARIES += jpeg
endif
ifeq ($(SUPPORT_PNG),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(PNG_LIBRARY_PATH)
LOCAL_CFLAGS += -DLOAD_PNG
LOCAL_STATIC_LIBRARIES += png
LOCAL_LDLIBS += -lz
endif
ifeq ($(SUPPORT_WEBP),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(WEBP_LIBRARY_PATH)/src
LOCAL_CFLAGS += -DLOAD_WEBP
LOCAL_STATIC_LIBRARIES += webp
endif
LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)
include $(BUILD_SHARED_LIBRARY)
don’t know if this can help, but on linux, I think the symlink had to be relative and not absolute .
My problem solved by adding in SDL_image\Android.mk
include $(CLEAR_VARS)
LOCAL_MODULE := SDL2
LOCAL_SRC_FILES := $(MY_SDK_HOME)/libraries/SDL/SDL/libs/$(TARGET_ARCH_ABI)/libSDL2.so
LOCAL_EXPORT_C_INCLUDES := $(MY_SDK_HOME)/libraries/SDL/SDL/include
include $(PREBUILT_SHARED_LIBRARY)
yes, you’re right. I have this also for each pre-built library needed.