readline-6.3 之arm平台交叉编译

来源:互联网 发布:知乎女神扒皮 编辑:程序博客网 时间:2024/05/20 23:04

        最近需要弄个CLI命令接口程序,初步设想是需要支持历史命令翻阅,tab键命令补全这样的一个东西。经查阅相关资料,深耕百度一番!(google最近不太正常)

实在恼火。发现readline果真是个好东西,于是将其先编译成arm平台。

./configure CC=arm-Linux-gcc --host=arm-linux CROSS_COMPILE=arm-linux-gcc

配置,起初发现在configure的时候,会自动编译一个test程序,而交叉编译出来的程序是无法载x86上运行的,所以Makefile自然没生成

此时需修改configure,


将6324行  if test "$cross_compiling" = no; then :中的yes改为no即可

mv xfree.o xfree.so
rm -f compat.so
arm-linux-gcc -c -DHAVE_CONFIG_H    -I. -I.. -I.. -DRL_LIBRARY_VERSION='"6.3"' -g -O -fPIC -o compat.o ../compat.c 
mv compat.o compat.so
rm -f libreadline.so.6.3
arm-linux-gcc -shared -Wl,-soname,libreadline.so.6.3 -L./lib/termcap -Wl,-rpath,/usr/local/lib -Wl,-soname,`basename libreadline.so.6.3 .3` -o libreadline.so.6.3 readline.so vi_mode.so funmap.so keymaps.so parens.so search.so rltty.so complete.so bind.so isearch.so display.so signals.so util.so kill.so undo.so macro.so input.so callback.so terminal.so text.so nls.so misc.so history.so histexpand.so histfile.so histsearch.so shell.so mbutil.so tilde.so colors.so parse-colors.so xmalloc.so xfree.so compat.so 
rm -f libhistory.so.6.3
arm-linux-gcc -shared -Wl,-soname,libhistory.so.6.3 -L./lib/termcap -Wl,-rpath,/usr/local/lib -Wl,-soname,`basename libhistory.so.6.3 .3` -o libhistory.so.6.3 history.so histexpand.so histfile.so histsearch.so shell.so mbutil.so xmalloc.so xfree.so 
make[1]: Leaving directory `/home/test/readline-6.3/shlib'

最终生成库