user3738303
user3738303

Reputation: 51

Error while compiling MuPDF 1.5 using Android NDK

I am facing a problem while compiling the new version of MuPDF 1.5 using Android NDK. Since there are alot of bug issues on the older version 1.4, I decided to upgrade to version 1.5 but unfortunately I've received compilation error messages as stated below:

Android NDK: WARNING:jni/Android.mk:mupdfcore: LOCAL_LDLIBS is always ignored for static libraries [armeabi-v7a] Compile thumb : mupdfcore <= pdf-op-run.c jni/../../../source/pdf/pdf-op-run.c: In function 'run_xobject': jni/../../../source/pdf/pdf-op-run.c:1732:3: error: format not a string literal and no format arguments [-Werror=format-security] cc1.exe: some warnings being treated as errors

/cygdrive/c/android-ndk-r9d/build/core/build-binary.mk:391: recipe for target 'obj/local/armeabi-v7a/objs/mupdfcore////source/pdf/pdf-op-run.o' failed make: * [obj/local/armeabi-v7a/objs/mupdfcore////source/pdf/pdf-op-run.o] Error 1

They have just released this new version 1.5 about 3 days ago. Have anyone facing the same problem? I'm using cygwin to "generate make" and compile it using ndk at platform/android. The compilation used to work for version 1.4 but not for 1.5. Hopefully someone here can help us out. Thanks.

Upvotes: 3

Views: 651

Answers (2)

JosephH
JosephH

Reputation: 37505

This is fixed on the master branch of mupdf now:

http://git.ghostscript.com/?p=mupdf.git;a=blobdiff;f=source/pdf/pdf-op-run.c;h=da881b2ef56d5c1cd9ace8a3c86f5a523bc94853;hp=2bea94b791ed341063f987171b611e377cf8ffa3;hb=77315e7139a9b412ab53a7d00cd0b019bd44b497;hpb=b2f096de23e5341fbbcd7c290f3a144423741906

It's probably best to just take the latest master (as it has a number of other Android bug fixes), but this is the patch if you need it:

diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c
index 2bea94b..da881b2 100644 (file)
--- a/source/pdf/pdf-op-run.c
+++ b/source/pdf/pdf-op-run.c
@@ -1729,7 +1729,7 @@ run_xobject(pdf_csi *csi, void *state, pdf_obj *resources, pdf_xobject *xobj, co

        /* Rethrow postponed errors */
        if (errmess[0])
-               fz_throw(ctx, FZ_ERROR_GENERIC, errmess);
+               fz_throw(ctx, FZ_ERROR_GENERIC, "%s", errmess);
 }

 static void pdf_run_BDC(pdf_csi *csi, void *state)

Upvotes: 3

user3738303
user3738303

Reputation: 51

Nevermind. I have solve the compiling issue. Just add %s as the argument at line 1732 to pdf-op-run.c as shown below:

fz_throw(ctx, FZ_ERROR_GENERIC, errmess, "%s");

My c code is abit rusty but hope this might help anyone who is stuck in the compiling the code.

Upvotes: 1

Related Questions