Game Development Reference
In-Depth Information
arm-none-linux-gnueabi-ld: warning: library search path "/usr/lib/jvm/java-6-
sun/jre/lib/i386" is unsafe for cross-compilation
arm-none-linux-gnueabi-ld: warning: cannot find entry symbol _start; defaulting to 00008340
Notice the warnings in Listing 2-7:
Library search path "/usr/lib/jvm/java-6-sun/jre/lib/i386" is unsafe for cross-compilation.
Here, the compiler is letting you know that the local system Java JNI libraries in this folder are not
safe (which makes sense, since you are compiling for a different architecture). However, you do need to
link against JNI, thus you have no choice.
Cannot find entry symbol start; defaulting to 00008340
This indicates that the loader cannot find an entry point for the library test program. By default, it
will call the first function in the file— main(int argc, char **argv) in this case.
Note Google does not provide support for JNI, or native development for that matter, as it wishes to push
development in Java. I think this is a mistake, as there is a lot of native code that can be ported into the device
(such as games). Sadly, native development has been neglected, although new tools such as the Native
Development Kit (NDK), described in Chapter 1, are trying to fix the problem.
Troubleshooting Missing Symbols
Before you run the project, you should make sure there are no missing symbols in the native library. This
can be a tricky process, as the successful compilation of a shared library will not tell you about missing
symbols. Even worse, if symbols are missing, and you try to run the program, the library will fail to load
at runtime, leaving you with the headache of figuring out what went wrong.
An easy solution is to write a simple C program that will invoke the library (see Listing 2-8). Then,
when linked, the compiler will tell you about missing symbols, which can then be fixed. This program
can be also useful in testing the library from the command line before testing from the application itself.
Listing 2-8. Simple Test Program for the Library
#include <stdio.h>
extern int lib_main(int argc, char **argv);
//void _start(int argc, char **argv)
int main(int argc, char **argv)
{
int i;
printf("Argc=%d Argv=%p\n", argc, argv);
 
Search WWH ::




Custom Search