简体   繁体   English

在mupdf上为OSX运行ndk-build时要使用哪个编译器?

[英]Which compiler to use when running ndk-build on mupdf for OSX?

I want to use mudf in my Android Studio project for viewing/editing PDF files, and I'm following the instructions at http://www.mupdf.com/docs/how-to-build-mupdf-for-android . 我想在我的Android Studio项目中使用mudf查看/编辑PDF文件,我按照http://www.mupdf.com/docs/how-to-build-mupdf-for-android上的说明进行操作。 I have the SDK and the NDK properly set up and the local.properties file configured to point to the correct respective paths. 我正确设置了SDK和NDK,并将local.properties文件配置为指向正确的相应路径。 Now, when I run ndk-build, I get the following output: 现在,当我运行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

Based on the answers at How to set standard c99 for compile android NDK project , I modified my Application.mk file to include the line APP_CFLAGS += -std=c99 基于如何为编译android NDK项目设置标准c99的答案,我修改了我的Application.mk文件以包含行APP_CFLAGS += -std=c99

When I run ndk-build again, I get the following: 当我再次运行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

After a little bit of searching on that, I changed the -c99 to -gnu99 and ran ndk-build again, only to get the initial errors again. 经过一番搜索后,我将-c99更改为-gnu99并再次运行ndk-build,只是为了再次获得初始错误。

What do I need to change/add to get rid of these, and also in general what steps should someone new to Android follow to include muPDF in an existing Android Studio project? 我需要更改/添加什么来摆脱这些,以及一般来说,Android的新手应遵循哪些步骤将muPDF包含在现有的Android Studio项目中?

The first issue, concerning __isinff and so on is I believe a known issue with the 64 bit android NDK, or at least related to some changes that Google has deliberately made to the NDKs. 第一个问题,关于__isinff等等,我相信64位android NDK的已知问题,或者至少与谷歌故意对NDK做出的一些改变有关。

If you revert back to an older, 32bit ndk, it should work - for example: 如果你恢复到较旧的32位ndk,它应该可以工作 - 例如:

http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin

Adding this to your Application.mk may also help too: 将此添加到您的Application.mk也可能有所帮助:

APP_PLATFORM := android-9

see, eg, https://groups.google.com/forum/#!topic/android-ndk/L2gc5HRq_dA 例如,参见https://groups.google.com/forum/#!topic/android-ndk/L2gc5HRq_dA

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM