views:

112

answers:

1

I am attempting to put my C++ program onto an Android phone but have run into several problems with the library linking. It seems most of the useful information I find on this topic through google is outdated (motz) or simply does not account for the complexity of my program. I have been able to run simple C programs but fail when attempting to use libraries outside of Android's Bionic/libc.

So my questions are:

  • Is it possible to port pre-existing *.so libraries onto Android? If so, how could I do this without seg faulting?
  • Should I be using the CodeSourcery compiler (arm-none-linux-gnueabi-*)?
  • How can I work around the lack of a seperate pthread library?

Please help me out! Thanks.

-Scott

+2  A: 

You can't use pre-existing *.so files because they need to be compiled for Android. In order to create an *.so for Android you need to use their NDK, which is already set up to build the correct format so you don't need to worry about arm-none-linux-gnueabi or anything. If you want to use a library that isn't available on Android you'll need to build it yourself using the NDK. I had to do this with the STL.

CaseyB
Thank you. I am in the process of creating Android.mk files for the libraries to allow them to compile with the source code (I have several libraries to include). For anyone interested, there is a good tutorial on Android.mk files at http://androidcore.com/ which is helping me get by.
Scott
surprisingly, i am doing the same right now :)another nice article is http://www.datasprings.com/Resources/ArticlesInformation/AndroidSDKExampleApplicationSampleCode/tabid/910/currentpage/6/Default.aspxif/when you find the way to debug C code, let me know :)
Noam