I'm really sorry for not being so specific about the topic. I gave up
the idea after trying trying and trying on that, so didn't even like to
dig into that again :-) .

The main problem which you will need to address is that the libraries we
use inside from your *.so files, will need the default linux linker
(ld-linux.so*), and some other *.so files. So we can get rid of the
problem of not having libraries in the Android platform by copying it
into the Android platform with other libraries and setting rpath
variable while compiling. Then all the libraries+programs you run on
Android will run successfully. They you also can run a C/C++ binary from
Android platform (using it's console).

But remember your all capabilities end when you try on using JNI, if you
have a look into the dalvik VM (I actually have forgotten the binary
name correspond to the vm inside Android), it will use a custom linker
(also do not remember the name, you can do a ldd after copying that
binary into the local machine-actually not ldd, but I guess
arm-none-linux-gnueabi-ldd as far as I remember). Then you will realize
that it will load a custom linker (NOT ld-linux as in ALL the other
Linux distributions), so when you see that point it's almost done buddy.
You can't load your libraries which you copied from cross-platform
development system, and the ones you built using that platform.

But I guess for very very simple *.so files, we can load from JNI, which
might have the neccessary symbols in libraries that included with
Android. Basically for me I wasted a lot of time doing these things.

My suggestion for you is that, do not go for serious development using
native libraries until the list of API functions in Android becomes
available. Else you will soon meet lots of troubles.

Thanks,
Diluka.









Ashutosh Malviya wrote:
>
>
> On Mon, Jun 2, 2008 at 5:29 PM, David Given <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     >>Ashutosh wrote:
>     >>[...]
>     > INFO/dalvikvm(1185): Unable to dlopen(/system/lib/libNativeCpp.so):
>     > Cannot find library
>
>     >>This error usually shows up for unresolved symbols.
>
>
> David Given wrote:
>
>     >>[...]
>     > System.loadLibrary("NativeC");
>     > System.loadLibrary("NativeAdd");
>
>     >>It's entirely possible that System.loadLibrary() doesn't allow
>     libraries
>     >>to see symbols defined in other libraries, so you won't be able
>     to have
>     >>NativeAdd depend on NativeC. However, I suspect your main
>     problem is...
>
>
> I tried to change the order of loading library (i.e. loading NativeAdd
> first and NativeC later, but android failed to load NativeAdd library,
> probably because it was not able to resolve symbol ret_mul .
>
> David Given wrote:
>
>     >>[...]
>     > #include <iostream>
>
>     >>iostream could well be trying to pull in symbols that the very
>     >>stripped-down libc supported by the dalvik executable won't have.
>
>
> Removing iostream and using 'extern "C"' made the library which has
> only one undefined symbol '__aeabi_unwind_cpp_pr0' which is available
> in /system/lib
>
>
> arm-none-linux-gnueabi-nm libNativeCpp.so
> 0000029c a _DYNAMIC
> 000002f4 a _GLOBAL_OFFSET_TABLE_
> U __aeabi_unwind_cpp_pr0
> 00000300 A __bss_end__
> 00000300 A __bss_start
> 00000300 A __bss_start__
> 00000300 D __data_start
> 00000300 A __end__
> 0000029c A __exidx_end
> 00000294 A __exidx_start
> 00000300 A _bss_end__
> 00000300 A _edata
> 00000300 A _end
> 00000260 T ret_mul_cpp
>
> Thanks for the help.
>
> But does this mean that all that big chunk of C and C++ source code
> that I wanted to port to android will not be possible ?
>
> I think Diluka had also experience problem porting his C/C++ code to
> android.
>
> Diluka, would you please comment on this. Could you port all your
> C/C++ source code to android? If yes could please give some points
> which I need to take care while porting my C/C++ source code?
>
> Thanks
> Ashutosh
>
>
>
>
>     --
>     ┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
>     │ "I have always wished for my computer to be as easy to use as my
>     │ telephone; my wish has come true because I can no longer figure out
>     │ how to use my telephone." --- Bjarne Stroustrup
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Internals" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/android-internals?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to