errors while compiling the MuPDF for android platform - android

I want to develop and android application which will help annotate the PDF files in android. Thus, I am using MuPDF to read and Parse the PDF files in android. I am trying to build it as specified in http://www.mupdf.com/doc/how-to-build-mupdf-for-android , but I have encountered the following error:
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:182: error: undefined reference to 'fz_unpack_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:193: error: undefined reference to 'fz_decode_indexed_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:200: error: undefined reference to 'fz_decode_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(load-tiff.o): in function fz_load_tiff:jni/../../../source/fitz/load-tiff.c:804: error: undefined reference to 'fz_unpack_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(load-png.o): in function fz_load_png:jni/../../../source/fitz/load-png.c:567: error: undefined reference to 'fz_unpack_tile'
On analyzing the first error, I understood that fz_unpack_tile, fz_decode_tile, fz_decode_indexed_tile are defined in fitz/draw-unpack.c
Now, I am not sure of how to continue from here

You asked this on irc yesterday, and I suggested that you do a complete clean, then rebuild from scratch capturing the logs and post them somewhere.
The code as supplied in git builds just fine in android for us. Without more information, no one is going to be able to help you.

Related

andEngine Android-Studio linker Error during Build

I took the source of AndEngine from their git repo, downloaded a fresh AndroidStudio, sdk and ndk,imported it, and tried to creat a simple new empty GameActivity extends BaseGameActivity.
But I could not start it, cause I get the following errors:
/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glVertexAttribPointer:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:9: error: undefined reference to 'glVertexAttribPointer'
/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glDrawElements:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:13: error: undefined reference to 'glDrawElements'
Error:Execution failed for task ':andEngine:compileReleaseNdk'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/uhu/android-ndk-r9d/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/Android.mk APP_PLATFORM=android-15 NDK_OUT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj NDK_LIBS_OUT=/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/lib APP_ABI=all
Error Code:
2
Output:
/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glVertexAttribPointer:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:9: error: undefined reference to 'glVertexAttribPointer'
/home/uhu/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: /home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/objs/andengine_shared//home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.o: in function Java_org_andengine_opengl_GLES20Fix_glDrawElements:/home/uhu/AndroidStudioProjects/aaa/andEngine/src/main/jni/src/GLES20Fix.c:13: error: undefined reference to 'glDrawElements'
collect2: ld returned 1 exit status
make: * [/home/uhu/AndroidStudioProjects/aaa/andEngine/build/intermediates/ndk/release/obj/local/armeabi-v7a/libandengine_shared.so] Error 1
Does anyone know how to fix this? Or if I'm just using the wrong tools, what can you recommend?
I managed to get my project to compile. The problem seems to me that AS and ndk dont work together well yet. Any case check my blog on setting up the project:-
AS and AndEngine setup
It seems to be easier using the official intellij version instead of android studio. And as both are very similar in use, it't doesn't really matter. Together with some ndk-build hints from the answer of lakshman5876, it finally worked very well. Thanks
http://www.jetbrains.com/idea/

Apportable error: undefined reference to 'OBJC_CLASS_$_FBSession'

Setup is according to given in Github/FacebookSDK and every thing is just fine,
but when run command apportable build it gives error like this
.../Source/AppDelegate.m:function L_OBJC_CLASSLIST_REFERENCES_$_125: error: undefined reference to 'OBJC_CLASS_$_FBSession'
.../Source/EndGame.m:function L_OBJC_CLASSLIST_REFERENCES_$_125: error: undefined reference to 'OBJC_CLASS_$_FBSession'
.../Source/EndGame.m:function L_OBJC_CLASSLIST_REFERENCES_$_147: error: undefined reference to 'OBJC_CLASS_$_FBRequest'
.../Source/EndGame.m:function L_OBJC_CLASSLIST_REFERENCES_$_257: error: undefined reference to 'OBJC_CLASS_$_FBRequestConnection'
what i am doing wrong ?
thanks
Apportable starter SDK version does not support Facebook ios SDK compilation. You must have an Indie Version to have support for social media SDKs.

ndk-build with sqlite library error

I am creating an android application which is having native C code along with sqlite database.
When I do a ndk-build from my jni folder,I am getting the following error.
undefined reference to `sqlite3_open'
peard.c:(.text+0x588): undefined reference to `sqlite3_exec'
peard.c:(.text+0x5f8): undefined reference to `sqlite3_exec'
peard.c:(.text+0x668): undefined reference to `sqlite3_exec'
peard.c:(.text+0x6d8): undefined reference to `sqlite3_prepare_v2'
peard.c:(.text+0x720): undefined reference to `sqlite3_column_count'
peard.c:(.text+0x734): undefined reference to `sqlite3_step'
peard.c:(.text+0x774): undefined reference to `sqlite3_column_text'
peard.c:(.text+0x78c): undefined reference to `sqlite3_column_name'
peard.c:(.text+0x800): undefined reference to `sqlite3_close'
I tried to run along with -lsqlite3 command also,but doesn't work.
Thanks.
I solved the problem by adding sqlite3.c source file to my dependency files list in my Android.mk file.Special thanks to hirschhomsalz.
Narain.
You need to build or install sqlite3 (and all other non standard libraries you project depends on) for android, and the build your project with the -L and -I parameters pointing to the arm version of you sqlite libraries and headers.

Problems with compiling C++ Source for Converting .off Files to XML Readable by Android OpenGL ES

I found a method for importing 3D models to Android's OpenGL on Stackoverflow here:
Is there a way to import a 3D model into Android?
Attempting to follow the instructions I copied the source and tried to compile the program. I got a massive number of errors, here is just a small sample:
/tmp/ccPavSpL.o:OFF-OpenGL_loader.cc:(.text+0xd): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::size() const'
I think the problem was I wasn't passing in arguments to the program, so I tried passing arguments like so:
$ gcc OFF-OpenGL_loader.cc circle.off output.xml
(My .off file was in the same directory as the other source files and the output.xml was also in the same file.)
I got these errors
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:circle.off: file format not recognized;
treating as linker script
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:circle.off:2: syntax error
collect2: ld returned 1 exit status
Anyway so I have a feeling I wasn't supposed to have an output.xml file but when I didn't have one then it gave me a file not found error.
The opensource files were not in actual files so I feel like I should show you all my files and I feel weird uploading someone else's source to a github repo, so here is a rapid share link to the source files:
http://d01.megashares.com/dl/2YylIbE/SourceCodeAnd.offFile.zip
I feel weird sharing files like this^^ but I don't really see any other option. It just contains my .off file and .xml file and the C and C++ files.
Any help would be greatly appreciated, I've spent the past few days stuck on this.
Thanks!
Edit
So I ran it with g++ and with no parameters and these were the results:
$ g++ OFF-OpenGL_loader.cc
/tmp/ccNFneYn.o:OFF-OpenGL_loader.cc:(.text+0x1aa): undefined reference to
`ReadFile::getExtension(char*)'/tmp/ccNFneYn.o:
OFF-OpenGL_loader.cc:(.text+0x2f8): undefined reference to
operator>>(std::basic_ifstream<char, std::
char_traits<char> >&, ReadFile&)'/tmp/ccNFneYn.o:OFF-
OpenGL_loader.cc:(.text+0x6de): undefined reference to `ReadFile::ReadFile()'/tmp/ccNFneYn.o:OFF-
OpenGL_loader.cc:(.text+0x6f9): undefined reference to `ReadFile::~ReadFile()'/usr/lib/gcc/i686-pc-
cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
/tmp/ccNFneYn.o: bad reloc address 0x1c in section
`.gcc_except_table'/usr/lib/gcc/i686-pc-cygwin/3.4.4/.
./../../../i686-pc-cygwin/bin/ld: final link failed:
Invalid operationcollect2: ld returned 1 exit status
What kind of errors am I looking for?
The problem was that when I ran my program in Visual Studio it would both compile and run the program, and because the source required parameters to be run, it would come up with runtime errors.
Then because I didn't know how to pass parameters to programs in visual studio, I tried using Cygwin which gave me errors, probably because it wasn't configured correctly. Not really sure why those errors happened.
So to solve this whole thing I just built my program with Visual Studio, navigated to the .exe file that it creates when it compiles, and then ran that .exe in the command line.
So the moral of the story is: always remember that when you hit that green play button, it both compiles and runs the program. So if your error has to do with the circumstances that you run your program in, you might get errors even if your code is perfectly fine.
Thanks Bo Persson for helping me get that idea!

undefined reference to `std::basic_string<wchar_t,

I am trying to compile my c++ files using cygwin.
\Files are compiled but linking time errors occur
These kind of errors...
undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::size() const'
and some more errors like
undefined reference to `sqlite3_mprintf'
undefined reference to `sqlite3_exec'
undefined reference to `sqlite3_free'
undefined reference to `sqlite3_free'
undefined reference to `sqlite3_free'
undefined reference to `sqlite3_exec'
please help me out?
Thank you.
It looks like the standard C++ library is not getting linked in. Are you linking your code with g++, gcc or ld? If using the first, that library gets linked in automatically, but not if you're using the other two.
For the errors about sqlite3, you need to add -lsqlite3 to the link command (assuming you have it installed, of course).

Categories

Resources