适用于Android的mupdf构建,多种目标模式

时间:2019-01-06 13:17:10

标签: android-studio android-ndk mupdf

我正在尝试从源代码构建mupdf-android-mini(因为我做了一些更改),所以我做了以下事情:

git clone git://git.ghostscript.com/mupdf-android-viewer-mini.git
cd mupdf-mini
git submodule update --init
cd jni
git submodule update --init
cd libmupdf
git submodule update --init

之后,我进行了更改,然后使用android studio打开整个内容, 我有 Android SDK Android NDK

Android Studio 将自动开始构建库,然后显示以下错误:

Error while executing process C:\Users\mohab\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\mohab\source\repos\shaboo\mupdf-android-viewer-mini\jni\libmupdf\platform\java\Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=C:/Users/mohab/source/repos/shaboo/mupdf-android-viewer-mini/jni/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Users\mohab\source\repos\shaboo\mupdf-android-viewer-mini\jni\build\intermediates\ndkBuild\release\lib -j4 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}


process_begin: CreateProcess(NULL, "", ...) failed.


*** multiple target patterns.  Stop.

在搜索了一下之后,我发现错误可能与android.mk文件有关, 所以我把它放在这里:

LOCAL_PATH := $(call my-dir)
MUPDF_PATH := $(realpath $(LOCAL_PATH)/../..)

# --- Include pre-built ghostscript library if building with gproof support ---

ifdef FZ_ENABLE_GPRF
include $(CLEAR_VARS)
LOCAL_MODULE := gsso
LOCAL_SRC_FILES := libgs.so
include $(PREBUILT_SHARED_LIBRARY)
endif

# --- Build a local static library for core mupdf ---

include $(CLEAR_VARS)

LOCAL_MODULE := mupdf_core

ifdef FZ_ENABLE_GPRF
LOCAL_CFLAGS += -DFZ_ENABLE_GPRF
endif

LOCAL_C_INCLUDES := \
    $(MUPDF_PATH)/include \
    $(MUPDF_PATH)/scripts/freetype \
    $(MUPDF_PATH)/scripts/libjpeg \
    $(MUPDF_PATH)/thirdparty/freetype/include \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src \
    $(MUPDF_PATH)/thirdparty/jbig2dec \
    $(MUPDF_PATH)/thirdparty/libjpeg \
    $(MUPDF_PATH)/thirdparty/lcms2/include \
    $(MUPDF_PATH)/thirdparty/mujs \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2 \
    $(MUPDF_PATH)/thirdparty/zlib \

LOCAL_CFLAGS := \
    -ffunction-sections -fdata-sections \
    -D_FILE_OFFSET_BITS=32 \
    -DTOFU_NOTO -DTOFU_CJK \
    -DAA_BITS=8 \
    -DOPJ_STATIC -DOPJ_HAVE_INTTYPES_H -DOPJ_HAVE_STDINT_H \

LOCAL_CFLAGS += \
    $(MUPDF_EXTRA_CFLAGS)

LOCAL_SRC_FILES += \
    $(wildcard $(MUPDF_PATH)/source/fitz/*.c) \
    $(wildcard $(MUPDF_PATH)/source/pdf/*.c) \
    $(wildcard $(MUPDF_PATH)/source/xps/*.c) \
    $(wildcard $(MUPDF_PATH)/source/svg/*.c) \
    $(wildcard $(MUPDF_PATH)/source/cbz/*.c) \
    $(wildcard $(MUPDF_PATH)/source/gprf/*.c) \
    $(wildcard $(MUPDF_PATH)/source/html/*.c) \
    $(wildcard $(MUPDF_PATH)/generated/resources/fonts/urw/*.c) \
    $(wildcard $(MUPDF_PATH)/generated/resources/fonts/sil/*.c) \

include $(BUILD_STATIC_LIBRARY)

# --- Build a local static library for thirdparty libraries ---

include $(CLEAR_VARS)

LOCAL_MODULE := mupdf_thirdparty

LOCAL_CPP_EXTENSION := .cc

LOCAL_C_INCLUDES := \
    $(MUPDF_PATH)/include \
    $(MUPDF_PATH)/include/mupdf \
    $(MUPDF_PATH)/scripts/freetype \
    $(MUPDF_PATH)/scripts/libjpeg \
    $(MUPDF_PATH)/thirdparty/freetype/include \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src \
    $(MUPDF_PATH)/thirdparty/jbig2dec \
    $(MUPDF_PATH)/thirdparty/libjpeg \
    $(MUPDF_PATH)/thirdparty/lcms2/include \
    $(MUPDF_PATH)/thirdparty/mujs \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2 \
    $(MUPDF_PATH)/thirdparty/zlib \

LOCAL_CFLAGS := \
    -ffunction-sections -fdata-sections \
    -DFT2_BUILD_LIBRARY -DDARWIN_NO_CARBON \
    '-DFT_CONFIG_MODULES_H="slimftmodules.h"' \
    '-DFT_CONFIG_OPTIONS_H="slimftoptions.h"' \
    -DHAVE_STDINT_H \
    -DOPJ_STATIC -DOPJ_HAVE_INTTYPES_H -DOPJ_HAVE_STDINT_H \

LOCAL_CFLAGS += \
    $(MUPDF_EXTRA_CFLAGS)

LOCAL_CPPFLAGS := \
    -ffunction-sections -fdata-sections \
    -fno-rtti -fno-exceptions -fvisibility-inlines-hidden \
    -DHAVE_FALLBACK=1 -DHAVE_OT -DHAVE_UCDN -DHB_NO_MT \
    -Dhb_malloc_impl=fz_hb_malloc \
    -Dhb_calloc_impl=fz_hb_calloc \
    -Dhb_realloc_impl=fz_hb_realloc \
    -Dhb_free_impl=fz_hb_free \

LOCAL_CPPFLAGS += \
    $(MUPDF_EXTRA_CPPFLAGS)

LOCAL_SRC_FILES += \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftbase.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftbbox.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftbitmap.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftdebug.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftgasp.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftglyph.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftinit.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftstroke.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftsynth.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/ftsystem.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/base/fttype1.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/cff/cff.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/cid/type1cid.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/psaux/psaux.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/pshinter/pshinter.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/psnames/psnames.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/raster/raster.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/sfnt/sfnt.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/smooth/smooth.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/truetype/truetype.c \
    $(MUPDF_PATH)/thirdparty/freetype/src/type1/type1.c \

LOCAL_SRC_FILES += \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-aat-layout.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-blob.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-buffer-serialize.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-buffer.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-common.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-face.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-fallback-shape.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-font.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ft.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-color.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-face.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-font.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-layout.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-map.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-math.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-arabic.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-default.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-hangul.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-hebrew.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-indic-table.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-indic.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-khmer.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-myanmar.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-thai.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-tibetan.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-use-table.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-complex-use.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-fallback.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape-normalize.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-shape.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-tag.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ot-var.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-set.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-shape-plan.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-shape.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-shaper.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-static.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-ucdn.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-unicode.cc \
    $(MUPDF_PATH)/thirdparty/harfbuzz/src/hb-warning.cc \

LOCAL_SRC_FILES += \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_arith.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_arith_iaid.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_arith_int.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_generic.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_halftone.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_huffman.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_image.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_mmr.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_page.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_refinement.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_segment.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_symbol_dict.c \
    $(MUPDF_PATH)/thirdparty/jbig2dec/jbig2_text.c \

LOCAL_SRC_FILES += \
    $(MUPDF_PATH)/thirdparty/libjpeg/jaricom.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jcomapi.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdapimin.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdapistd.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdarith.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdatadst.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdatasrc.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdcoefct.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdcolor.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jddctmgr.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdhuff.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdinput.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdmainct.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdmarker.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdmaster.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdmerge.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdpostct.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdsample.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jdtrans.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jerror.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jfdctflt.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jfdctfst.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jfdctint.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jidctflt.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jidctfst.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jidctint.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jmemmgr.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jquant1.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jquant2.c \
    $(MUPDF_PATH)/thirdparty/libjpeg/jutils.c \

LOCAL_SRC_FILES += \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsalpha.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmscam02.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmscgats.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmscnvrt.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmserr.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsgamma.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsgmt.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmshalf.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsintrp.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsio0.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsio1.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmslut.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsmd5.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsmtrx.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsnamed.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsopt.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmspack.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmspcs.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsplugin.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsps2.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmssamp.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmssm.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmstypes.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsvirt.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmswtpnt.c \
    $(MUPDF_PATH)/thirdparty/lcms2/src/cmsxform.c

LOCAL_SRC_FILES += \
    $(MUPDF_PATH)/thirdparty/mujs/one.c \

LOCAL_SRC_FILES += \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/bio.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/cio.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/dwt.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/event.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/function_list.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/image.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/invert.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/j2k.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/jp2.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/mct.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/mqc.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/openjpeg.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/pi.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/sparse_array.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/t1.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/t2.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/tcd.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/tgt.c \
    $(MUPDF_PATH)/thirdparty/openjpeg/src/lib/openjp2/thread.c \

LOCAL_SRC_FILES += \
    $(MUPDF_PATH)/thirdparty/zlib/adler32.c \
    $(MUPDF_PATH)/thirdparty/zlib/compress.c \
    $(MUPDF_PATH)/thirdparty/zlib/crc32.c \
    $(MUPDF_PATH)/thirdparty/zlib/deflate.c \
    $(MUPDF_PATH)/thirdparty/zlib/inffast.c \
    $(MUPDF_PATH)/thirdparty/zlib/inflate.c \
    $(MUPDF_PATH)/thirdparty/zlib/inftrees.c \
    $(MUPDF_PATH)/thirdparty/zlib/trees.c \
    $(MUPDF_PATH)/thirdparty/zlib/uncompr.c \
    $(MUPDF_PATH)/thirdparty/zlib/zutil.c \

include $(BUILD_STATIC_LIBRARY)

# --- Build the final JNI shared library ---

include $(CLEAR_VARS)

LOCAL_MODULE := mupdf_java

LOCAL_C_INCLUDES := \
    $(MUPDF_PATH)/include

LOCAL_CFLAGS := \
    -DHAVE_ANDROID

LOCAL_CFLAGS += \
    $(MUPDF_EXTRA_CFLAGS)

LOCAL_SRC_FILES := \
    $(MUPDF_PATH)/platform/java/mupdf_native.c

LOCAL_STATIC_LIBRARIES := mupdf_core mupdf_thirdparty

LOCAL_LDLIBS := -ljnigraphics -llog -lm
LOCAL_LDLIBS += $(MUDPF_EXTRA_LDLIBS)

LOCAL_LDFLAGS := -Wl,--gc-sections
LOCAL_LDFLAGS += $(MUDPF_EXTRA_LDFLAGS)

include $(BUILD_SHARED_LIBRARY)

谢谢。

1 个答案:

答案 0 :(得分:0)

构建说明在这里:

https://github.com/ArtifexSoftware/mupdf-android-viewer-mini/blob/master/README

我强烈建议您重新开始并严格按照说明进行操作,这些说明显示了如何从命令行进行构建。目前,很难知道您是否错过了某个步骤,设置是否存在问题等等。

如果失败,建议将 full 日志上传到pastebin(或类似文件),然后将链接添加到您的问题。

一旦命令行构建成功,您就可以尝试从Android Studio构建。