readline-6.3 之arm平台交叉编译

时间:2022-06-04 05:20:20

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

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

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



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

此时需改动configure,

readline-6.3 之arm平台交叉编译

将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'



终于生成库

readline-6.3 之arm平台交叉编译