How to get libreadline for Android?


http://stackoverflow.com/questions/17697779/how-to-get-libreadline-for-android


I found myself also needing to compile libreadline for arm-linux-androideabi. What I did was the following:

  1. download source code for libreadline gnu.
  2. set CC to the android-ndk cross compiler (CC=~/android/lib/bin/arm-linux-androideabi-gcc)
  3. update the config.sub and config.guess files (the ones in the libreadline source are very old and don't have arm-linux-androideabi)

    $ cp /usr/share/misc/config.{sub,guess} support/.

  4. run ./configure with --host and --prefix set to the target architecture and the locations for the compiled objects

    $ CC=~/android/lib/bin/arm-linux-androideabi-gcc ./configure --build=arm-linux-androideabi --prefix=~/android/lib/

  5. make && make install and it worked for me! I have libreadline.a and libreadline.so files in ~/android/lib/lib

Note, before I had updated the support/config.sub and support/config.guess files I was getting the same error described in the question.


posted @ 2016-07-05 11:26  张同光  阅读(92)  评论(0编辑  收藏  举报