Error undefined reference in build muPDF for android (need help) - android

this is sample error in cygwin
C:/mupdf-0.8.165/android/jni/../../mupdf/pdf_nametree.c:111:
undefined reference to `fz_array_get'
C:/mupdf-0.8.165/android/jni/../../mupdf/pdf_nametree.c:112:
undefined reference to `fz_is_string'
C:/mupdf-0.8.165/android/jni/../../mupdf/pdf_nametree.c:115:
undefined reference to `fz_dict_put'
C:/mupdf-0.8.165/android/jni/../../mupdf/pdf_nametree.c:116:
undefined reference to `fz_drop_obj'
In pdf_nametree include fitz.h
actually I check the function fz_array_get in fitz.h already
I have no idea now
Can anybody point me to the right direction or give me a another way
thx
sasara

Looks like your %path% variable (DOS) was not correctly translated to the $PATH (Cygwin) variable....
You need to install both the Android SDK as well as the Android NDK. Then you need to add both <sdk-install-dir>\tools and <ndk-install-dir> to your %path% variable.
Also, you need Cygwin v1.7 or greater on Windows.
Then, look here: http://groups.google.com/group/android-ndk/msg/b385e47e1484c2d4 for 2 fixes which deal with bugs that occur for automatic conversion from DOS format path variables to Cygwin format path variables.

Related

Fastlane screengrab not reading config

I'm starting to use screengrab to make automated screenshots of my app. I've a question regarding the "config" file named "Appfile".
Here is content:
json_key_file "" # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one
app_package_name 'be.example.android.app'
app_apk_path 'app/build/outputs/apk/dev/debug/APP-DEV-debug-0.9.0.apk'
tests_apk_path 'app/build/outputs/apk/androidTest/dev/debug/app-dev-debug-androidTest.apk'
locales ['en-US', 'fr-FR']
clear_previous_screenshots true
When I execute fastlane, errors are displayed and it seems fastlane is not able to understand Appfile.
git:(develop) ✗ fastlane screengrab
[12:02:58]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
undefined method `app_package_name' for #<CredentialsManager::AppfileConfig:0x007f81cf463220>
undefined method `app_package_name' for #<CredentialsManager::AppfileConfig:0x007f81cf42b320>
undefined method `app_package_name' for #<CredentialsManager::AppfileConfig:0x007f81cf418fe0>
[12:03:01]: To not be asked about this value, you can specify it using 'app_package_name'
[12:03:01]: The package name of the app under test (e.g. com.yourcompany.yourapp): ^Cundefined method `app_package_name' for #<CredentialsManager::AppfileConfig:0x007f81cf30ba80>
undefined method `app_package_name' for #<CredentialsManager::AppfileConfig:0x007f81cf2f9538>
Does anyone have an idea what I do wrong ? Thanks a lot.
Nevermind, the config file is no longer called "Appfile" but "Screengrabfile" now...

errors while compiling the MuPDF for android platform

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.

Compiling for Android using Make on OSX

Fair warning I am somewhat new to GCC development.
I am currently trying to do a personal port of Box2D to android (tech arm). I create a standalone toolchain, export the following....
export PATH=/tmp/my-android-toolchain/bin:$PATH
export CC=arm-linux-androideabi-gcc
export CXX=arm-linux-androideabi-g++
Then I run Make, everything "seems" to be running fine, however, at the end I see...
/private/tmp/my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: bin/Debug/libBox2D.a: no archive symbol table (run ranlib)
/private/tmp/my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: obj/Debug/HelloWorld/Helloworld.o: in function main:../../HelloWorld/Helloworld.cpp:38: error: undefined reference to 'b2World::b2World(b2Vec2 const&)'
/private/tmp/my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: obj/Debug/HelloWorld/Helloworld.o: in function main:../../HelloWorld/Helloworld.cpp:47: error: undefined reference to 'b2World::CreateBody(b2BodyDef const*)'
/private/tmp/my-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: obj/Debug/HelloWorld/Helloworld.o: in function main:../../HelloWorld/Helloworld.cpp:53: error: undefined reference to 'b2PolygonShape::SetAsBox(float, float)'
If I open up a new terminal (essentially killing the exports) and delete the bin and obj folder everything compiles fine. A quick Google search suggests this could be related to it using the llvm compiler instead of GCC (although with my CC I think this less likely). There are the following instructions for llvm in the standalone toolchain doc...
If you wish, add --llvm-version=3.1 to also copy clang/llvm 3.1.
Should I add llvm? Is this an issue with bionic being different?
Thanks!
You are likely using the OSX version of ar. Can't tell for sure from you log. Try setting export AR=arm-linux-androideabi-ar

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!

Categories

Resources