lilac / Android-ImageMagick

ImageMagick library ported to Android
211 stars 58 forks source link

The rebuild script just nets me an 'undefined modules' error #9

Open Gensoukyou1337 opened 6 years ago

Gensoukyou1337 commented 6 years ago

I wanted to rebuild the Android-ImageMagick library, but with modified files from jmagick's misc repo containing the distortImage functionality. My problem is that with the rebuild script as is (though with the first line being changed into export NDK=<NDK path>), it just nets me:

Android NDK: Found platform level in F:/android-imagemagick/project.properties. Setting APP_PLATFORM to android-8.
Android NDK: android-8 is unsupported. Using minimum supported version android-14.
Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 8 in F:/android-imagemagick/AndroidManifest.xml. NDK binaries will *not* be compatible with devices older than android-14. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
Android NDK: WARNING:F:/Android-ImageMagick/ndk-modules/ImageMagick-6.7.3-0/magick/Android.mk:MagickCore: LOCAL_LDLIBS is always ignored for static libraries   
Android NDK: WARNING:F:/Android-ImageMagick/ndk-modules/ImageMagick-6.7.3-0/magick/Android.mk:MagickCore: non-system libraries in linker flags: -lfreetype -lpng
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK:     current module
Android NDK: WARNING:F:/android-imagemagick/jni/Android.mk:android-magick: non-system libraries in linker flags: -lfreetype -lpng
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK:     current module
F:/android-ndk-r17b/build//../build/core/build-binary.mk:688: Android NDK: Module android-magick depends on undefined modules: png freetype z
F:/android-ndk-r17b/build//../build/core/build-binary.mk:701: *** Android NDK: Aborting (set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies)    .  Stop.

Which part of the Android.mk file in the jni folder do I need to change?

Gensoukyou1337 commented 6 years ago

Here's my current modified jni/Android.mk file that resolved this:

Magick_Home := F:/Android-ImageMagick/ndk-modules/ImageMagick-6.7.3-0

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE    := android-magick
LOCAL_SRC_FILES := jmagick.c
LOCAL_SRC_FILES += magick_DrawInfo.c
LOCAL_SRC_FILES += magick_ImageInfo.c
LOCAL_SRC_FILES += magick_Magick.c
LOCAL_SRC_FILES += magick_MagickImage.c
LOCAL_SRC_FILES += magick_MagickInfo.c
LOCAL_SRC_FILES += magick_MontageInfo.c
LOCAL_SRC_FILES += magick_PixelPacket.c
LOCAL_SRC_FILES += magick_QuantizeInfo.c \
                   magick_MagickBitmap.c

LOCAL_C_INCLUDES += $(Magick_Home)/include/ImageMagick
LOCAL_C_INCLUDES += $(Magick_Home)
LOCAL_CFLAGS += -L$(Magick_Home)/lib
LOCAL_STATIC_LIBRARIES := MagickCore jpeg coders tiff-static filters
LOCAL_SHARED_LIBRARIES += MagickCore jpeg coders tiff-static filters

#LOCAL_SHARED_LIBRARIES := MagickCore png15 bz2 gomp pthread
LOCAL_LDLIBS += -L$(LOCAL_PATH)/../lib -lz -lfreetype -lpng -llog

include $(BUILD_SHARED_LIBRARY)

include F:/android-imagemagick/lib/freetype/jni/Android.mk
include F:/android-imagemagick/lib/libpng/jni/Android.mk
include F:/android-imagemagick/lib/zlib/jni/Android.mk

$(call import-module,ImageMagick-6.7.3-0)
$(call import-module,jpeg)

The includes are for the freetype, libpng, and zlib modules in the lib folder. I also had to change the LOCAL_MODULE name in the lib/zlib/jni/Android.mk to libz from zlib.

MolotovCherry commented 4 years ago

If you want the latest and greatest imagemagick features on android, even with the option for jmagick support baked in, check out my repo. https://github.com/cherryleafroad/Android-ImageMagick7