UnsatisfiedLinkError 在 Android 4.4 libDevil 中找不到符号“png_set_longjmp_fn”

Posted

技术标签:

【中文标题】UnsatisfiedLinkError 在 Android 4.4 libDevil 中找不到符号“png_set_longjmp_fn”【英文标题】:UnsatisfiedLinkError In Android 4.4 libDevil cannot locate symbol "png_set_longjmp_fn" 【发布时间】:2014-01-09 00:53:43 【问题描述】:

我在 google play 上有一个运行良好且运行良好的 image converter 应用程序,它结合了 NDK 以使用 DevIL 图像处理库支持更多文件格式。

它在大多数设备上都可以正常工作,但自从 android 4.4 Kitkat 推出以来,我在 Google Play 控制台上收到了电子邮件和崩溃报告,尤其是来自具有 4.4 的 Nexus 设备以及现在接收更新的其他旧设备

这是崩溃报告

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "png_set_longjmp_fn" referenced by "libdevil.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:364)
at java.lang.System.loadLibrary(System.java:526)
at com.paul.icon.MainActivity.<clinit>(Unknown Source)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)

应用程序无法启动,并且从我自己的调试开始,它来自加载 libdevil 时 MainActivity.java 的第一行

static 
        System.loadLibrary("physfs");
        System.loadLibrary("jpeg");
        System.loadLibrary("tiff");
        System.loadLibrary("mng");
        System.loadLibrary("png");
        System.loadLibrary("jasper");
        System.loadLibrary("lcms");
        System.loadLibrary("devil");
        System.loadLibrary("mylib");
    

说……

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "png_set_longjmp_fn" referenced by "libdevil.so"...

这是我的 android.mk 文件

LOCAL_PATH := $(call my-dir)

PHYSFS_SRC_PATH     := physfs-2.0.2/
TIFF_SRC_PATH       := tiff-3.9.5/
MNG_SRC_PATH        := libmng-1.0.10/
LCMS_SRC_PATH       := lcms2-2.2/
PNG_SRC_PATH        := libpng-1.5.6/
JPEG_SRC_PATH       := jpeg-8c/
JASPER_SRC_PATH     := jasper-1.900.1/
DEVIL_SRC_PATH      := devil-1.7.8/


#libjpeg
include $(CLEAR_VARS)

LOCAL_MODULE    := libjpeg
LOCAL_MODULE_FILENAME := libjpeg

LOCAL_SRC_FILES := \
        $JPEG_SRC_PATHjcapimin.c $JPEG_SRC_PATHjcapistd.c $JPEG_SRC_PATHjccoefct.c $JPEG_SRC_PATHjccolor.c $JPEG_SRC_PATHjcdctmgr.c $JPEG_SRC_PATHjchuff.c \
        $JPEG_SRC_PATHjcinit.c $JPEG_SRC_PATHjcmainct.c $JPEG_SRC_PATHjcmarker.c $JPEG_SRC_PATHjcmaster.c $JPEG_SRC_PATHjcomapi.c $JPEG_SRC_PATHjcparam.c \
        $JPEG_SRC_PATHjcprepct.c $JPEG_SRC_PATHjcsample.c $JPEG_SRC_PATHjctrans.c $JPEG_SRC_PATHjdapimin.c $JPEG_SRC_PATHjdapistd.c \
        $JPEG_SRC_PATHjdatadst.c $JPEG_SRC_PATHjdatasrc.c $JPEG_SRC_PATHjdcoefct.c $JPEG_SRC_PATHjdcolor.c $JPEG_SRC_PATHjddctmgr.c $JPEG_SRC_PATHjdhuff.c \
        $JPEG_SRC_PATHjdinput.c $JPEG_SRC_PATHjdmainct.c $JPEG_SRC_PATHjdmarker.c $JPEG_SRC_PATHjdmaster.c $JPEG_SRC_PATHjdmerge.c \
        $JPEG_SRC_PATHjdpostct.c $JPEG_SRC_PATHjdsample.c $JPEG_SRC_PATHjdtrans.c $JPEG_SRC_PATHjerror.c $JPEG_SRC_PATHjfdctflt.c $JPEG_SRC_PATHjfdctfst.c \
        $JPEG_SRC_PATHjfdctint.c $JPEG_SRC_PATHjidctflt.c $JPEG_SRC_PATHjidctfst.c $JPEG_SRC_PATHjidctint.c $JPEG_SRC_PATHjquant1.c \
        $JPEG_SRC_PATHjquant2.c $JPEG_SRC_PATHjutils.c $JPEG_SRC_PATHjmemmgr.c $JPEG_SRC_PATHjcarith.c $JPEG_SRC_PATHjdarith.c $JPEG_SRC_PATHjaricom.c

# Use the no backing store memory manager provided by
# libjpeg. See install.txt
LOCAL_SRC_FILES += \
        $JPEG_SRC_PATHjmemnobs.c

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)

include $(BUILD_STATIC_LIBRARY)

#libtiff
include $(CLEAR_VARS)

LOCAL_MODULE    := libtiff
LOCAL_CFLAGS    := -g -Dlinux -DFT2_BUILD_LIBRARY=1 -DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT
LOCAL_CPPFLAGS  := $LOCAL_CFLAGS

LOCAL_C_INCLUDES  :=  \
    $TIFF_SRC_PATHlibtiff/ \
    $JPEG_SRC_PATH \

LOCAL_SRC_FILES := \
    $TIFF_SRC_PATHlibtiff/tif_dir.c \
    $TIFF_SRC_PATHlibtiff/tif_codec.c \
    $TIFF_SRC_PATHlibtiff/tif_predict.c \
    $TIFF_SRC_PATHlibtiff/tif_tile.c \
    $TIFF_SRC_PATHlibtiff/tif_version.c \
    $TIFF_SRC_PATHlibtiff/tif_unix.c \
    $TIFF_SRC_PATHlibtiff/tif_swab.c \
    $TIFF_SRC_PATHlibtiff/tif_thunder.c \
    $TIFF_SRC_PATHlibtiff/tif_next.c \
    $TIFF_SRC_PATHlibtiff/tif_strip.c \
    $TIFF_SRC_PATHlibtiff/tif_extension.c \
    $TIFF_SRC_PATHlibtiff/tif_error.c \
    $TIFF_SRC_PATHlibtiff/tif_dirwrite.c \
    $TIFF_SRC_PATHlibtiff/tif_fax3sm.c \
    $TIFF_SRC_PATHlibtiff/tif_ojpeg.c \
    $TIFF_SRC_PATHlibtiff/tif_flush.c \
    $TIFF_SRC_PATHlibtiff/tif_warning.c \
    $TIFF_SRC_PATHlibtiff/tif_fax3.c \
    $TIFF_SRC_PATHlibtiff/tif_jbig.c \
    $TIFF_SRC_PATHlibtiff/tif_open.c \
    $TIFF_SRC_PATHlibtiff/tif_write.c \
    $TIFF_SRC_PATHlibtiff/tif_packbits.c \
    $TIFF_SRC_PATHlibtiff/tif_compress.c \
    $TIFF_SRC_PATHlibtiff/tif_color.c \
    $TIFF_SRC_PATHlibtiff/tif_print.c \
    $TIFF_SRC_PATHlibtiff/tif_zip.c \
    $TIFF_SRC_PATHlibtiff/tif_aux.c \
    $TIFF_SRC_PATHlibtiff/tif_dumpmode.c \
    $TIFF_SRC_PATHlibtiff/tif_dirread.c \
    $TIFF_SRC_PATHlibtiff/tif_getimage.c \
    $TIFF_SRC_PATHlibtiff/tif_jpeg.c \
    $TIFF_SRC_PATHlibtiff/tif_close.c \
    $TIFF_SRC_PATHlibtiff/tif_read.c \
    $TIFF_SRC_PATHlibtiff/tif_luv.c \
    $TIFF_SRC_PATHlibtiff/tif_dirinfo.c \
    $TIFF_SRC_PATHlibtiff/tif_lzw.c \
    $TIFF_SRC_PATHlibtiff/tif_pixarlog.c \
    $TIFF_SRC_PATHport/lfind.c 

LOCAL_LDLIBS    := -llog -L../lib -lGLESv1_CM

LOCAL_STATIC_LIBRARIES := libjpeg libphysfs

include $(BUILD_SHARED_LIBRARY)


#libphysfs
include $(CLEAR_VARS)

LOCAL_MODULE    := libphysfs
LOCAL_CFLAGS    := -g -Dlinux -Dunix -DFT2_BUILD_LIBRARY=1 -DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT \
                    -DPHYSFS_SUPPORTS_APK=1 -DPHYSFS_SUPPORTS_ZIP=1 -DPHYSFS_SUPPORTS_ZIP=1 -DPHYSFS_SUPPORTS_7Z=1 -DPHYSFS_SUPPORTS_GRP=1 -DPHYSFS_SUPPORTS_QPAK=1 -DPHYSFS_SUPPORTS_HOG=1 -DPHYSFS_SUPPORTS_MVL=1 -DPHYSFS_SUPPORTS_WAD=1

LOCAL_CPPFLAGS  := $LOCAL_CFLAGS

LOCAL_C_INCLUDES  :=  \
    $PHYSFS_SRC_PATH 

LOCAL_SRC_FILES := \
    $PHYSFS_SRC_PATH/physfs.c \
    $PHYSFS_SRC_PATH/physfs_byteorder.c \
    $PHYSFS_SRC_PATH/physfs_unicode.c \
    $PHYSFS_SRC_PATH/platform/os2.c \
    $PHYSFS_SRC_PATH/platform/pocketpc.c \
    $PHYSFS_SRC_PATH/platform/posix.c \
    $PHYSFS_SRC_PATH/platform/unix.c \
    $PHYSFS_SRC_PATH/platform/macosx.c \
    $PHYSFS_SRC_PATH/platform/windows.c \
    $PHYSFS_SRC_PATH/archivers/dir.c \
    $PHYSFS_SRC_PATH/archivers/grp.c \
    $PHYSFS_SRC_PATH/archivers/hog.c \
    $PHYSFS_SRC_PATH/archivers/lzma.c \
    $PHYSFS_SRC_PATH/archivers/mvl.c \
    $PHYSFS_SRC_PATH/archivers/qpak.c \
    $PHYSFS_SRC_PATH/archivers/wad.c \
    $PHYSFS_SRC_PATH/archivers/zip.c \
    $PHYSFS_SRC_PATH/archivers/apk.c \
    $PHYSFS_SRC_PATH/lzma/C/7zCrc.c \
    $PHYSFS_SRC_PATH/lzma/C/Archive/7z/7zBuffer.c \
    $PHYSFS_SRC_PATH/lzma/C/Archive/7z/7zDecode.c \
    $PHYSFS_SRC_PATH/lzma/C/Archive/7z/7zExtract.c \
    $PHYSFS_SRC_PATH/lzma/C/Archive/7z/7zHeader.c \
    $PHYSFS_SRC_PATH/lzma/C/Archive/7z/7zIn.c \
    $PHYSFS_SRC_PATH/lzma/C/Archive/7z/7zItem.c \
    $PHYSFS_SRC_PATH/lzma/C/Archive/7z/7zMethodID.c \
    $PHYSFS_SRC_PATH/lzma/C/Compress/Branch/BranchX86.c \
    $PHYSFS_SRC_PATH/lzma/C/Compress/Branch/BranchX86_2.c \
    $PHYSFS_SRC_PATH/lzma/C/Compress/Lzma/LzmaDecode.c \
    $PHYSFS_SRC_PATH/zlib123/adler32.c \
    $PHYSFS_SRC_PATH/zlib123/compress.c \
    $PHYSFS_SRC_PATH/zlib123/crc32.c \
    $PHYSFS_SRC_PATH/zlib123/deflate.c \
    $PHYSFS_SRC_PATH/zlib123/gzio.c \
    $PHYSFS_SRC_PATH/zlib123/infback.c \
    $PHYSFS_SRC_PATH/zlib123/inffast.c \
    $PHYSFS_SRC_PATH/zlib123/inflate.c \
    $PHYSFS_SRC_PATH/zlib123/inftrees.c \
    $PHYSFS_SRC_PATH/zlib123/trees.c \
    $PHYSFS_SRC_PATH/zlib123/uncompr.c \
    $PHYSFS_SRC_PATH/zlib123/zutil.c \



LOCAL_LDLIBS    := -llog -L../lib -lGLESv1_CM

LOCAL_STATIC_LIBRARIES := 

include $(BUILD_SHARED_LIBRARY)

#libmng
include $(CLEAR_VARS)

LOCAL_MODULE    := libmng
LOCAL_CFLAGS    := -g -Dlinux -DFT2_BUILD_LIBRARY=1 -DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT
LOCAL_CPPFLAGS  := $LOCAL_CFLAGS

LOCAL_C_INCLUDES  :=  \
    $JPEG_SRC_PATH \
    $MNG_SRC_PATH

LOCAL_SRC_FILES := \
    $MNG_SRC_PATHlibmng_write.c \
    $MNG_SRC_PATHlibmng_object_prc.c \
    $MNG_SRC_PATHlibmng_display.c \
    $MNG_SRC_PATHlibmng_chunk_xs.c \
    $MNG_SRC_PATHlibmng_chunk_io.c \
    $MNG_SRC_PATHlibmng_read.c \
    $MNG_SRC_PATHlibmng_prop_xs.c \
    $MNG_SRC_PATHlibmng_filter.c \
    $MNG_SRC_PATHlibmng_chunk_descr.c \
    $MNG_SRC_PATHlibmng_cms.c \
    $MNG_SRC_PATHlibmng_zlib.c \
    $MNG_SRC_PATHlibmng_pixels.c \
    $MNG_SRC_PATHlibmng_error.c \
    $MNG_SRC_PATHlibmng_trace.c \
    $MNG_SRC_PATHlibmng_jpeg.c \
    $MNG_SRC_PATHlibmng_callback_xs.c \
    $MNG_SRC_PATHlibmng_dither.c \
    $MNG_SRC_PATHlibmng_hlapi.c \
    $MNG_SRC_PATHlibmng_chunk_prc.c \

LOCAL_LDLIBS    := -llog -L../lib -lGLESv1_CM

LOCAL_STATIC_LIBRARIES := libjpeg libphysfs

include $(BUILD_SHARED_LIBRARY)


#liblcms
include $(CLEAR_VARS)

LOCAL_MODULE    := liblcms
LOCAL_CFLAGS    := -g -Dlinux -DFT2_BUILD_LIBRARY=1 -DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT
LOCAL_CPPFLAGS  := $LOCAL_CFLAGS

LOCAL_C_INCLUDES  :=  \
    $LCMS_SRC_PATHinclude/ \

LOCAL_SRC_FILES := \
    $LCMS_SRC_PATHsrc/cmscam02.c \
    $LCMS_SRC_PATHsrc/cmserr.c \
    $LCMS_SRC_PATHsrc/cmstypes.c \
    $LCMS_SRC_PATHsrc/cmsmd5.c \
    $LCMS_SRC_PATHsrc/cmswtpnt.c \
    $LCMS_SRC_PATHsrc/cmsgmt.c \
    $LCMS_SRC_PATHsrc/cmspcs.c \
    $LCMS_SRC_PATHsrc/cmsopt.c \
    $LCMS_SRC_PATHsrc/cmscnvrt.c \
    $LCMS_SRC_PATHsrc/cmsps2.c \
    $LCMS_SRC_PATHsrc/cmssamp.c \
    $LCMS_SRC_PATHsrc/cmsplugin.c \
    $LCMS_SRC_PATHsrc/cmsmtrx.c \
    $LCMS_SRC_PATHsrc/cmspack.c \
    $LCMS_SRC_PATHsrc/cmsio0.c \
    $LCMS_SRC_PATHsrc/cmsgamma.c \
    $LCMS_SRC_PATHsrc/cmscgats.c \
    $LCMS_SRC_PATHsrc/cmsxform.c \
    $LCMS_SRC_PATHsrc/cmsnamed.c \
    $LCMS_SRC_PATHsrc/cmssm.c \
    $LCMS_SRC_PATHsrc/cmsio1.c \
    $LCMS_SRC_PATHsrc/cmsintrp.c \
    $LCMS_SRC_PATHsrc/cmslut.c \
    $LCMS_SRC_PATHsrc/cmsvirt.c \

LOCAL_LDLIBS    := -llog -L../lib -lGLESv1_CM

LOCAL_STATIC_LIBRARIES :=  

include $(BUILD_SHARED_LIBRARY)

#libpng
include $(CLEAR_VARS)

LOCAL_MODULE    := libpng
LOCAL_CFLAGS    := -g -Dlinux -DFT2_BUILD_LIBRARY=1 -DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT
LOCAL_CPPFLAGS  := $LOCAL_CFLAGS

LOCAL_C_INCLUDES  :=  \
    $PNG_SRC_PATH \

LOCAL_SRC_FILES := \
    $PNG_SRC_PATHpngerror.c \
    $PNG_SRC_PATHpngwio.c \
    $PNG_SRC_PATHpngwrite.c \
    $PNG_SRC_PATHpngwutil.c \
    $PNG_SRC_PATHpngwtran.c \
    $PNG_SRC_PATHpngset.c \
    $PNG_SRC_PATHpngtrans.c \
    $PNG_SRC_PATHexample.c \
    $PNG_SRC_PATHpng.c \
    $PNG_SRC_PATHpngrtran.c \
    $PNG_SRC_PATHpngmem.c \
    $PNG_SRC_PATHpngpread.c \
    $PNG_SRC_PATHpngrutil.c \
    $PNG_SRC_PATHpngrio.c \
    $PNG_SRC_PATHpngget.c \
    $PNG_SRC_PATHpngread.c \

LOCAL_LDLIBS    := -llog -L../lib -lGLESv1_CM

LOCAL_STATIC_LIBRARIES := libphysfs

include $(BUILD_SHARED_LIBRARY)

#libjasper
include $(CLEAR_VARS)

LOCAL_MODULE    := libjasper
LOCAL_CFLAGS    := -g -Dlinux -DFT2_BUILD_LIBRARY=1 -DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT
LOCAL_CPPFLAGS  := $LOCAL_CFLAGS

LOCAL_C_INCLUDES  :=  \
    $JASPER_SRC_PATHsrc/libjasper/include \
    $JPEG_SRC_PATH \

LOCAL_SRC_FILES := \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_cm.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_getopt.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_seq.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_malloc.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_init.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_debug.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_stream.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_string.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_version.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_tmr.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_image.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_tvp.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_iccdata.c \
    $JASPER_SRC_PATHsrc/libjasper/base/jas_icc.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_mqcod.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_t1enc.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_dec.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_math.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_util.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_bs.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_tagtree.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_t1cod.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_t2enc.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_mqenc.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_enc.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_qmfb.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_t1dec.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_cs.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_t2cod.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_tsfb.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_mqdec.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_t2dec.c \
    $JASPER_SRC_PATHsrc/libjasper/jpc/jpc_mct.c \
    $JASPER_SRC_PATHsrc/libjasper/dummy.c \
    $JASPER_SRC_PATHsrc/libjasper/pnm/pnm_dec.c \
    $JASPER_SRC_PATHsrc/libjasper/pnm/pnm_enc.c \
    $JASPER_SRC_PATHsrc/libjasper/pnm/pnm_cod.c \
    $JASPER_SRC_PATHsrc/libjasper/jp2/jp2_enc.c \
    $JASPER_SRC_PATHsrc/libjasper/jp2/jp2_cod.c \
    $JASPER_SRC_PATHsrc/libjasper/jp2/jp2_dec.c \
    $JASPER_SRC_PATHsrc/libjasper/pgx/pgx_dec.c \
    $JASPER_SRC_PATHsrc/libjasper/pgx/pgx_enc.c \
    $JASPER_SRC_PATHsrc/libjasper/pgx/pgx_cod.c \
    $JASPER_SRC_PATHsrc/libjasper/bmp/bmp_enc.c \
    $JASPER_SRC_PATHsrc/libjasper/bmp/bmp_dec.c \
    $JASPER_SRC_PATHsrc/libjasper/bmp/bmp_cod.c \
    $JASPER_SRC_PATHsrc/libjasper/jpg/jpg_val.c \
    $JASPER_SRC_PATHsrc/libjasper/jpg/jpg_enc.c \
    $JASPER_SRC_PATHsrc/libjasper/jpg/jpg_dec.c \
    $JASPER_SRC_PATHsrc/libjasper/ras/ras_cod.c \
    $JASPER_SRC_PATHsrc/libjasper/ras/ras_dec.c \
    $JASPER_SRC_PATHsrc/libjasper/ras/ras_enc.c \
    $JASPER_SRC_PATHsrc/libjasper/mif/mif_cod.c \

LOCAL_LDLIBS    := -llog -L../lib -lGLESv1_CM

LOCAL_STATIC_LIBRARIES := libjpeg

include $(BUILD_SHARED_LIBRARY)

#libdevil
include $(CLEAR_VARS)

LOCAL_MODULE    := libdevil
LOCAL_CFLAGS    := -g -Dlinux -DFT2_BUILD_LIBRARY=1 -DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT -fexceptions
LOCAL_CPPFLAGS  := $LOCAL_CFLAGS


LOCAL_C_INCLUDES  :=  \
    $DEVIL_SRC_PATHinclude \
    $DEVIL_SRC_PATHsrc-IL/include \
    $DEVIL_SRC_PATHsrc-ILU/include \
    $JASPER_SRC_PATHsrc/libjasper/include \
    $PHYSFS_SRC_PATH \
    $PHYSFS_SRC_PATHzlib123 \
    $PNG_SRC_PATH \
    $MNG_SRC_PATH \
    $JPEG_SRC_PATH \
    $LCMS_SRC_PATHinclude/ \
    $TIFF_SRC_PATHlibtiff/ \

LOCAL_SRC_FILES := \
    $DEVIL_SRC_PATHsrc-IL/src/il_sun.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_wdp.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_doom.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_jp2.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_tpl.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_size.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_rle.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_gif.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_states.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_psp.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_devil.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_convbuff.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_ftx.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_vtf.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_iff.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_lif.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_pcx.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_io.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_files.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_fastconv.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_error.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_main.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_utx.cpp \
    $DEVIL_SRC_PATHsrc-IL/src/il_pcd.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_neuquant.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_dds.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_dicom.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_wal.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_icon.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_blp.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_mp3.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_header.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_alloc.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_sgi.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_stack.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_texture.c \
    $DEVIL_SRC_PATHsrc-IL/src/altivec_typeconversion.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_targa.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_bmp.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_mdl.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_pix.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_pnm.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_ilbm.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_icns.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_cut.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_profiles.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_hdr.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_register.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_exr.cpp \
    $DEVIL_SRC_PATHsrc-IL/src/il_iwi.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_mng.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_rot.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_jpeg.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_png.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_pxr.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_nvidia.cpp \
    $DEVIL_SRC_PATHsrc-IL/src/il_squish.cpp \
    $DEVIL_SRC_PATHsrc-IL/src/il_utility.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_internal.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_psd.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_endian.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_quantizer.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_wbmp.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_manip.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_pic.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_tiff.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_pal.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_dds-save.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_raw.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_convert.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_dcx.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_fits.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_xpm.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_bits.c \
    $DEVIL_SRC_PATHsrc-IL/src/altivec_common.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_dpx.c \
    $DEVIL_SRC_PATHsrc-IL/src/il_rawdata.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_alloc.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_error.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_filter_rcg.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_filter.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_internal.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_main.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_manip.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_mipmap.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_noise.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_region.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_rotate.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_scale.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_scale2d.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_scale3d.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_scaling.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_states.c \
    $DEVIL_SRC_PATHsrc-ILU/src/ilu_utilities.c \

LOCAL_LDLIBS    := -llog -L../lib -lGLESv1_CM -DFT2_BUILD_LIBRARY=1

LOCAL_STATIC_LIBRARIES := \
    libjasper \
    libpng \
    libmng \
    libjpeg \
    liblcms \
    libphysfs \
    libtiff

include $(BUILD_SHARED_LIBRARY)



#mylib
include $(CLEAR_VARS)
LOCAL_MODULE    := libmylib
LOCAL_CFLAGS    := -g -Dlinux -DFT2_BUILD_LIBRARY=1 -DPHYSFS_NO_CDROM_SUPPORT=1 -DAL_ALEXT_PROTOTYPES=1 -DHAVE_GCC_DESTRUCTOR=1 -DOPT_GENERIC -DREAL_IS_FLOAT -fexceptions
LOCAL_CPPFLAGS  := $LOCAL_CFLAGS
LOCAL_C_INCLUDES  :=  \
    $DEVIL_SRC_PATHinclude \
    $DEVIL_SRC_PATHsrc-IL/include \
    $DEVIL_SRC_PATHsrc-ILU/include \
    $JASPER_SRC_PATHsrc/libjasper/include \
    $PHYSFS_SRC_PATH \
    $PHYSFS_SRC_PATHzlib123 \
    $PNG_SRC_PATH \
    $MNG_SRC_PATH \
    $JPEG_SRC_PATH \
    $LCMS_SRC_PATHinclude/ \
    $TIFF_SRC_PATHlibtiff/ \


LOCAL_SRC_FILES := native.cpp

LOCAL_LDLIBS    := -llog -lGLESv2

LOCAL_STATIC_LIBRARIES := \
    libjasper \
    libpng \
    libmng \
    libjpeg \
    liblcms \
    libphysfs \
    libtiff \
    libdevil \


include $(BUILD_SHARED_LIBRARY)

还有我的 application.mk

APP_STL := gnustl_static
APP_ABI := armeabi-v7a

在我的整个 jni 文件夹中搜索 png_set_longjmp_fn 字符串后,我在我的 libpng 文件夹的以下文件中找到了它。下面是sn-ps。

pngerror.c

#ifdef PNG_SETJMP_SUPPORTED
/* This API only exists if ANSI-C style error handling is used,
 * otherwise it is necessary for png_default_error to be overridden.
 */
jmp_buf* PNGAPI
png_set_longjmp_fn(png_structrp png_ptr, png_longjmp_ptr longjmp_fn,
    size_t jmp_buf_size)

   /* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value
    * and it must not change after that.  Libpng doesn't care how big the
    * buffer is, just that it doesn't change.
    *
    * If the buffer size is no *larger* than the size of jmp_buf when libpng is

symbols.def

;Version 1.6.2
;--------------------------------------------------------------
; LIBPNG symbol list as a Win32 DEF file
; Contains all the symbols that can be exported from libpng
;--------------------------------------------------------------
LIBRARY

    EXPORTS

         png_access_version_number @1
         png_set_sig_bytes @2
         png_sig_cmp @3
         png_create_read_struct @4
         png_create_write_struct @5
         png_get_compression_buffer_size @6
         png_set_compression_buffer_size @7
         png_set_longjmp_fn @8
         png_longjmp @9

png.h

#ifdef PNG_SETJMP_SUPPORTED
/* This function returns the jmp_buf built in to *png_ptr.  It must be
 * supplied with an appropriate 'longjmp' function to use on that jmp_buf
 * unless the default error function is overridden in which case NULL is
 * acceptable.  The size of the jmp_buf is checked against the actual size
 * allocated by the library - the call will return NULL on a mismatch
 * indicating an ABI mismatch.
 */
PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr,
    png_longjmp_ptr longjmp_fn, size_t jmp_buf_size));
#  define png_jmpbuf(png_ptr) \
      (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
#else

非常感谢任何帮助 kitkat 找到它的帮助。

【问题讨论】:

【参考方案1】:

从我所有的谷歌搜索来看,我认为 Android 4.4 试图将任何名为 libpng 的东西链接到它自己的 libpng 1.2.46,我的 libpng 1.5.6 有 png_set_longjmp_fn 符号,而 4.4 使用的那个没有

所以我去了我的 android.mk 文件并将 libpng 重命名为 libpngo 以及我的 mainactivity 中的 system.load 东西。

现在可以正常工作了。

【讨论】:

哇,这是一个很棒的发现! “system.load thingy”似乎意味着将System.loadLibrary("png");更改为System.loadLibrary("pngo"); 这里只是重命名不起作用。最后,我用静态链接的 libpng 编译了我的代码,所以我不必添加共享库。但很好的发现。感谢分享。

以上是关于UnsatisfiedLinkError 在 Android 4.4 libDevil 中找不到符号“png_set_longjmp_fn”的主要内容,如果未能解决你的问题,请参考以下文章

UnsatisfiedLinkError:找不到依赖库

Java 问题“UnsatisfiedLinkError”

SmartGWT 库的 UnsatisfiedLinkError

java.lang.UnsatisfiedLinkError

在 Java 中使用 TESSERACT API 时出现 java.lang.UnsatisfiedLinkError 异常

java.lang.UnsatisfiedLinkError - 运行 z/OS 应用程序时