运行 ndk-build on mupdf for OSX 时使用哪个编译器?
Which compiler to use when running ndk-build on mupdf for OSX?
我想在我的 Android Studio 项目中为 viewing/editing 个 PDF 文件使用 mudf,我正在按照 http://www.mupdf.com/docs/how-to-build-mupdf-for-android 中的说明进行操作。我已正确设置 SDK 和 NDK,并将 local.properties 文件配置为指向正确的相应路径。现在,当我 运行 ndk-build 时,我得到以下输出:
armeabi-v7a] Compile thumb : mupdfthirdparty <= cff.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= type1cid.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= psaux.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= pshinter.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= psnames.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= raster.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= smooth.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= sfnt.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= truetype.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= type1.c
[armeabi-v7a] StaticLibrary : libmupdfthirdparty.a
[armeabi-v7a] SharedLibrary : libmupdf_java.so
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/printf.c:29: error: undefined reference to '__isinff'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:332: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:227: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsparse.c:869: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:318: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsnumber.c:40: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/json.c:107: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsvalue.c:14: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsvalue.c:226: error: undefined reference to '__isinf'
collect2: error: ld returned 1 exit status
make: *** [/Users/aayushkothari/Codes/mupdf/platform/android/viewer/obj/local/armeabi-v7a/libmupdf_java.so] Error 1
根据 How to set standard c99 for compile android NDK project 的回答,我修改了我的 Application.mk 文件以包含行 APP_CFLAGS += -std=c99
当我再次 运行 ndk-build 时,我得到以下信息:
[armeabi-v7a] Compile thumb : mupdf_java <= mupdf.c
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/mupdf.c: In function 'Java_com_artifex_mupdfdemo_MuPDFCore_getFocusedWidgetSignatureState':
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/mupdf.c:2361:2: warning: implicit declaration of function 'pdf_signatures_supported' [-Wimplicit-function-declaration]
if (!pdf_signatures_supported())
^
[armeabi-v7a] Compile thumb : mupdfcore <= bbox-device.c
[armeabi-v7a] Compile thumb : mupdfcore <= bidi-std.c
[armeabi-v7a] Compile thumb : mupdfcore <= bidi.c
[armeabi-v7a] Compile thumb : mupdfcore <= bitmap.c
[armeabi-v7a] Compile thumb : mupdfcore <= buffer.c
[armeabi-v7a] Compile thumb : mupdfcore <= colorspace.c
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c: In function 'fast_cmyk_to_rgb_ARM':
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:2: error: 'asm' undeclared (first use in this function)
asm volatile(
^
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:2: note: each undeclared identifier is reported only once for each function it appears in
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:6: error: expected ';' before 'volatile'
asm volatile(
^
make: *** [/Users/aayushkothari/Codes/mupdf/platform/android/viewer/obj/local/armeabi-v7a/objs/mupdfcore/__/__/__/__/source/fitz/colorspace.o] Error 1
经过一些搜索后,我将 -c99 更改为 -gnu99 并再次 运行 ndk-build,但再次出现初始错误。
我需要什么来 change/add 摆脱这些,以及通常 Android 的新手应该遵循什么步骤将 muPDF 包含在现有的 Android Studio 项目中?
第一个问题,关于 __isinff 等等,我认为是 64 位 android NDK 的一个已知问题,或者至少与 Google 故意进行的一些更改有关为 NDK 制作。
如果您恢复到较旧的 32 位 ndk,它应该可以工作 - 例如:
http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin
将此添加到您的 Application.mk 中也可能有帮助:
APP_PLATFORM := android-9
参见,例如,https://groups.google.com/forum/#!topic/android-ndk/L2gc5HRq_dA
我想在我的 Android Studio 项目中为 viewing/editing 个 PDF 文件使用 mudf,我正在按照 http://www.mupdf.com/docs/how-to-build-mupdf-for-android 中的说明进行操作。我已正确设置 SDK 和 NDK,并将 local.properties 文件配置为指向正确的相应路径。现在,当我 运行 ndk-build 时,我得到以下输出:
armeabi-v7a] Compile thumb : mupdfthirdparty <= cff.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= type1cid.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= psaux.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= pshinter.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= psnames.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= raster.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= smooth.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= sfnt.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= truetype.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= type1.c
[armeabi-v7a] StaticLibrary : libmupdfthirdparty.a
[armeabi-v7a] SharedLibrary : libmupdf_java.so
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/printf.c:29: error: undefined reference to '__isinff'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:332: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:227: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsparse.c:869: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:318: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsnumber.c:40: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/json.c:107: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsvalue.c:14: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsvalue.c:226: error: undefined reference to '__isinf'
collect2: error: ld returned 1 exit status
make: *** [/Users/aayushkothari/Codes/mupdf/platform/android/viewer/obj/local/armeabi-v7a/libmupdf_java.so] Error 1
根据 How to set standard c99 for compile android NDK project 的回答,我修改了我的 Application.mk 文件以包含行 APP_CFLAGS += -std=c99
当我再次 运行 ndk-build 时,我得到以下信息:
[armeabi-v7a] Compile thumb : mupdf_java <= mupdf.c
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/mupdf.c: In function 'Java_com_artifex_mupdfdemo_MuPDFCore_getFocusedWidgetSignatureState':
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/mupdf.c:2361:2: warning: implicit declaration of function 'pdf_signatures_supported' [-Wimplicit-function-declaration]
if (!pdf_signatures_supported())
^
[armeabi-v7a] Compile thumb : mupdfcore <= bbox-device.c
[armeabi-v7a] Compile thumb : mupdfcore <= bidi-std.c
[armeabi-v7a] Compile thumb : mupdfcore <= bidi.c
[armeabi-v7a] Compile thumb : mupdfcore <= bitmap.c
[armeabi-v7a] Compile thumb : mupdfcore <= buffer.c
[armeabi-v7a] Compile thumb : mupdfcore <= colorspace.c
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c: In function 'fast_cmyk_to_rgb_ARM':
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:2: error: 'asm' undeclared (first use in this function)
asm volatile(
^
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:2: note: each undeclared identifier is reported only once for each function it appears in
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:6: error: expected ';' before 'volatile'
asm volatile(
^
make: *** [/Users/aayushkothari/Codes/mupdf/platform/android/viewer/obj/local/armeabi-v7a/objs/mupdfcore/__/__/__/__/source/fitz/colorspace.o] Error 1
经过一些搜索后,我将 -c99 更改为 -gnu99 并再次 运行 ndk-build,但再次出现初始错误。
我需要什么来 change/add 摆脱这些,以及通常 Android 的新手应该遵循什么步骤将 muPDF 包含在现有的 Android Studio 项目中?
第一个问题,关于 __isinff 等等,我认为是 64 位 android NDK 的一个已知问题,或者至少与 Google 故意进行的一些更改有关为 NDK 制作。
如果您恢复到较旧的 32 位 ndk,它应该可以工作 - 例如:
http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin
将此添加到您的 Application.mk 中也可能有帮助:
APP_PLATFORM := android-9
参见,例如,https://groups.google.com/forum/#!topic/android-ndk/L2gc5HRq_dA