@cyysu
        
        2018-08-10T01:20:57.000000Z
        字数 13821
        阅读 2092
    
- 时间:2017年11月15日16:17:45
 - 作者:Kali
 - 邮箱:cyysu.github.io@gmail.com/2869905223@qq.com/微信lwyx1413
 - 版本:4.0
 - 描述:嵌入式ARM上移植vim
 
Linux字符界面系列教程
VIM这个编译工具也是依赖于ncurses,所以在编译vim之前首先要编译ncurses,这个在我们移植htop的时候就已经编译过了,我这里就不在演示编译过程了。只需要做一下下面这个链接就可以了。如果有小伙伴不知道怎么编译的可以查看下面这篇教程。进入lib目录,创建littinfo的符号链接cd libln -s libncurses.so.5 libtinfo.so.5ln -s libtinfo.so.5 libtinfo.so
下面我们直接编译vim
root@DZ:~# cd /home/mj/htop_arm/vim74/root@DZ:/home/mj/htop_arm/vim74# ./configure --prefix=/home/mj/install_vim --with-features=tiny --disable-gui --without-x --disable-selinux --disable-acl --disable-gpm CPPFLAGS=-I/home/mj/install_ncurses/include/ncurses LDFLAGS=-L/home/mj/install_ncurses/libconfigure: creating cache auto/config.cachechecking whether make sets $(MAKE)... yeschecking for gcc... gccchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables...checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none neededchecking how to run the C preprocessor... gcc -Echecking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin/grep -Echecking for library containing strerror... none requiredchecking for gawk... gawkchecking for strip... stripchecking for ANSI C header files... yeschecking for sys/wait.h that is POSIX.1 compatible... yeschecking --enable-fail-if-missing argument... noconfigure: checking for buggy tools...checking for BeOS... nochecking for QNX... nochecking for Darwin (Mac OS X)... nochecking --with-local-dir argument... Defaulting to /usr/localchecking --with-vim-name argument... Defaulting to vimchecking --with-ex-name argument... Defaulting to exchecking --with-view-name argument... Defaulting to viewchecking --with-global-runtime argument... nochecking --with-modified-by argument... nochecking if character set is EBCDIC... nochecking --disable-selinux argument... yeschecking --with-features argument... tinychecking --with-compiledby argument... nochecking --disable-xsmp argument... nochecking --disable-xsmp-interact argument... nochecking --enable-luainterp argument... nochecking --enable-mzschemeinterp argument... nochecking --enable-perlinterp argument... nochecking --enable-pythoninterp argument... nochecking --enable-python3interp argument... nochecking --enable-tclinterp argument... nochecking --enable-rubyinterp argument... nochecking --enable-cscope argument... nochecking --enable-workshop argument... nochecking --disable-netbeans argument... nochecking for socket in -lsocket... nochecking for gethostbyname in -lnsl... yeschecking whether compiling netbeans integration is possible... yeschecking --enable-sniff argument... nochecking --enable-multibyte argument... nochecking --enable-hangulinput argument... nochecking --enable-xim argument... defaulting to autochecking --enable-fontset argument... nodefaulting to: don't HAVE_X11checking --enable-gui argument... no GUI supportchecking X11/SM/SMlib.h usability... yeschecking X11/SM/SMlib.h presence... yeschecking for X11/SM/SMlib.h... yeschecking for CYGWIN environment... nochecking whether toupper is broken... nochecking whether __DATE__ and __TIME__ work... yeschecking whether __attribute__((unused)) is allowed... yeschecking elf.h usability... yeschecking elf.h presence... yeschecking for elf.h... yeschecking for main in -lelf... nochecking for dirent.h that defines DIR... yeschecking for library containing opendir... none requiredchecking stdarg.h usability... yeschecking stdarg.h presence... yeschecking for stdarg.h... yeschecking stdint.h usability... yeschecking stdint.h presence... yeschecking for stdint.h... yeschecking stdlib.h usability... yeschecking stdlib.h presence... yeschecking for stdlib.h... yeschecking string.h usability... yeschecking string.h presence... yeschecking for string.h... yeschecking sys/select.h usability... yeschecking sys/select.h presence... yeschecking for sys/select.h... yeschecking sys/utsname.h usability... yeschecking sys/utsname.h presence... yeschecking for sys/utsname.h... yeschecking termcap.h usability... yeschecking termcap.h presence... yeschecking for termcap.h... yeschecking fcntl.h usability... yeschecking fcntl.h presence... yeschecking for fcntl.h... yeschecking sgtty.h usability... yeschecking sgtty.h presence... yeschecking for sgtty.h... yeschecking sys/ioctl.h usability... yeschecking sys/ioctl.h presence... yeschecking for sys/ioctl.h... yeschecking sys/time.h usability... yeschecking sys/time.h presence... yeschecking for sys/time.h... yeschecking sys/types.h usability... yeschecking sys/types.h presence... yeschecking for sys/types.h... yeschecking termio.h usability... yeschecking termio.h presence... yeschecking for termio.h... yeschecking iconv.h usability... yeschecking iconv.h presence... yeschecking for iconv.h... yeschecking inttypes.h usability... yeschecking inttypes.h presence... yeschecking for inttypes.h... yeschecking langinfo.h usability... yeschecking langinfo.h presence... yeschecking for langinfo.h... yeschecking math.h usability... yeschecking math.h presence... yeschecking for math.h... yeschecking unistd.h usability... yeschecking unistd.h presence... yeschecking for unistd.h... yeschecking stropts.h usability... yeschecking stropts.h presence... yeschecking for stropts.h... yeschecking errno.h usability... yeschecking errno.h presence... yeschecking for errno.h... yeschecking sys/resource.h usability... yeschecking sys/resource.h presence... yeschecking for sys/resource.h... yeschecking sys/systeminfo.h usability... nochecking sys/systeminfo.h presence... nochecking for sys/systeminfo.h... nochecking locale.h usability... yeschecking locale.h presence... yeschecking for locale.h... yeschecking sys/stream.h usability... nochecking sys/stream.h presence... nochecking for sys/stream.h... nochecking termios.h usability... yeschecking termios.h presence... yeschecking for termios.h... yeschecking libc.h usability... nochecking libc.h presence... nochecking for libc.h... nochecking sys/statfs.h usability... yeschecking sys/statfs.h presence... yeschecking for sys/statfs.h... yeschecking poll.h usability... yeschecking poll.h presence... yeschecking for poll.h... yeschecking sys/poll.h usability... yeschecking sys/poll.h presence... yeschecking for sys/poll.h... yeschecking pwd.h usability... yeschecking pwd.h presence... yeschecking for pwd.h... yeschecking utime.h usability... yeschecking utime.h presence... yeschecking for utime.h... yeschecking sys/param.h usability... yeschecking sys/param.h presence... yeschecking for sys/param.h... yeschecking libintl.h usability... yeschecking libintl.h presence... yeschecking for libintl.h... yeschecking libgen.h usability... yeschecking libgen.h presence... yeschecking for libgen.h... yeschecking util/debug.h usability... nochecking util/debug.h presence... nochecking for util/debug.h... nochecking util/msg18n.h usability... nochecking util/msg18n.h presence... nochecking for util/msg18n.h... nochecking frame.h usability... nochecking frame.h presence... nochecking for frame.h... nochecking sys/acl.h usability... nochecking sys/acl.h presence... nochecking for sys/acl.h... nochecking sys/access.h usability... nochecking sys/access.h presence... nochecking for sys/access.h... nochecking sys/sysinfo.h usability... yeschecking sys/sysinfo.h presence... yeschecking for sys/sysinfo.h... yeschecking wchar.h usability... yeschecking wchar.h presence... yeschecking for wchar.h... yeschecking wctype.h usability... yeschecking wctype.h presence... yeschecking for wctype.h... yeschecking for sys/ptem.h... nochecking for sys/sysctl.h... yeschecking for pthread_np.h... nochecking strings.h usability... yeschecking strings.h presence... yeschecking for strings.h... yeschecking if strings.h can be included after string.h... yeschecking whether gcc needs -traditional... nochecking for an ANSI C-conforming const... yeschecking for working volatile... yeschecking for mode_t... yeschecking for off_t... yeschecking for pid_t... yeschecking for size_t... yeschecking for uid_t in sys/types.h... yeschecking for uint32_t... yeschecking whether time.h and sys/time.h may both be included... yeschecking for ino_t... yeschecking for dev_t... yeschecking whether byte ordering is bigendian... nochecking for rlim_t... yeschecking for stack_t... yeschecking whether stack_t has an ss_base field... nochecking --with-tlib argument... empty: automatic terminal library selectionchecking for tgetent in -ltinfo... yeschecking whether we talk terminfo... yeschecking what tgetent() returns for an unknown terminal... zerochecking whether termcap.h contains ospeed... yeschecking whether termcap.h contains UP, BC and PC... yeschecking whether tputs() uses outfuntype... nochecking whether sys/select.h and sys/time.h may both be included... yeschecking for /dev/ptc... nochecking for SVR4 ptys... yeschecking for ptyranges... don't knowchecking default tty permissions/group... can't determine - assume ptys are world accessibleworldchecking return type of signal handlers... voidchecking for struct sigcontext... yeschecking getcwd implementation is broken... nochecking for bcmp... yeschecking for fchdir... yeschecking for fchown... yeschecking for fsync... yeschecking for getcwd... yeschecking for getpseudotty... nochecking for getpwent... yeschecking for getpwnam... yeschecking for getpwuid... yeschecking for getrlimit... yeschecking for gettimeofday... yeschecking for getwd... yeschecking for lstat... yeschecking for memcmp... yeschecking for memset... yeschecking for mkdtemp... yeschecking for nanosleep... yeschecking for opendir... yeschecking for putenv... yeschecking for qsort... yeschecking for readlink... yeschecking for select... yeschecking for setenv... yeschecking for setpgid... yeschecking for setsid... yeschecking for sigaltstack... yeschecking for sigstack... yeschecking for sigset... yeschecking for sigsetjmp... nochecking for sigaction... yeschecking for sigvec... nochecking for strcasecmp... yeschecking for strerror... yeschecking for strftime... yeschecking for stricmp... nochecking for strncasecmp... yeschecking for strnicmp... nochecking for strpbrk... yeschecking for strtol... yeschecking for tgetent... yeschecking for towlower... yeschecking for towupper... yeschecking for iswupper... yeschecking for usleep... yeschecking for utime... yeschecking for utimes... yeschecking for _LARGEFILE_SOURCE value needed for large files... nochecking for special C compiler options needed for large files... nochecking for _FILE_OFFSET_BITS value needed for large files... nochecking for st_blksize... yeschecking whether stat() ignores a trailing slash... nochecking for iconv_open()... yeschecking for nl_langinfo(CODESET)... yeschecking for strtod in -lm... yeschecking for strtod() and other floating point functions... yeschecking --disable-acl argument... yeschecking --disable-gpm argument... yeschecking --disable-sysmouse argument... nochecking for sysmouse... nochecking for FD_CLOEXEC... yeschecking for rename... yeschecking for sysctl... not usablechecking for sysinfo... yeschecking for sysinfo.mem_unit... yeschecking for sysconf... yeschecking size of int... 4checking size of long... 8checking size of time_t... 8checking size of off_t... 8checking uint32_t is 32 bits... okchecking whether memmove handles overlaps... yeschecking for _xpg4_setrunelocale in -lxpg4... nochecking how to create tags... ctags -I INIT+ --fields=+Schecking how to run man with a section nr... man -schecking --disable-nls argument... nochecking for msgfmt... msgfmtchecking for NLS... gettext() workschecking for bind_textdomain_codeset... yeschecking for _nl_msg_cat_cntr... yeschecking dlfcn.h usability... yeschecking dlfcn.h presence... yeschecking for dlfcn.h... yeschecking for dlopen()... nochecking for dlopen() in -ldl... yeschecking for dlsym()... yeschecking setjmp.h usability... yeschecking setjmp.h presence... yeschecking for setjmp.h... yeschecking for GCC 3 or later... yeschecking whether we need -D_FORTIFY_SOURCE=1... yeschecking linker --as-needed support... yesconfigure: updating cache auto/config.cacheconfigure: creating auto/config.statusconfig.status: creating auto/config.mkconfig.status: creating auto/config.h# 开始执行编译root@DZ:/home/mj/htop_arm/vim74# make CC=arm-none-linux-gnueabi-gcc......OLD_PO_FILE_INPUT=yes msgfmt -v -o ru.mo ru.po1869 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o sk.mo sk.po1628 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o sv.mo sv.po1697 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o uk.mo uk.po1819 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o vi.mo vi.po1422 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_CN.UTF-8.mo zh_CN.UTF-8.po1634 条已翻译消息,3 条模糊消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_CN.mo zh_CN.po1633 条已翻译消息,3 条模糊消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_TW.UTF-8.mo zh_TW.UTF-8.po1422 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_TW.mo zh_TW.po1422 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o cs.cp1250.mo cs.cp1250.po1284 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o ja.sjis.mo ja.sjis.po1869 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o ja.euc-jp.mo ja.euc-jp.po1869 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o pl.cp1250.mo pl.cp1250.po1869 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o pl.UTF-8.mo pl.UTF-8.po1869 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o ru.cp1251.mo ru.cp1251.po1869 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o sk.cp1250.mo sk.cp1250.po1628 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o uk.cp1251.mo uk.cp1251.po1819 条已翻译消息.OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_CN.cp936.mo zh_CN.cp936.po1633 条已翻译消息,3 条模糊消息.make[2]: Leaving directory '/home/mj/htop_arm/vim74/src/po'make[2]: Entering directory '/home/mj/htop_arm/vim74/src/po'make[2]: Nothing to be done for 'converted'.make[2]: Leaving directory '/home/mj/htop_arm/vim74/src/po'make[1]: Leaving directory '/home/mj/htop_arm/vim74/src'# 移植成功标志root@DZ:/home/mj/htop_arm/vim74/src# file vimvim: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.16, not stripped
# 将移植到开发板的ncurses的库也做上如下的链接ln -s libncurses.so.5 libtinfo.so.5ln -s libtinfo.so.5 libtinfo.soroot@DZ:/home/mj/htop_arm/vim74/src# scp vim root@master:/tmproot@master's password:vim 100% 1911KB 1.9MB/s 00:00# 嵌入式ARM端[root@3352-T tmp]# lsdbus/ libform.so* libmenu.so* libncurses.so* libpanel.so* libtinfo.so.5@htop* libform.so.5* libmenu.so.5* libncurses.so.5* libpanel.so.5* resolv.conflibcurses.a libform.so.5.9* libmenu.so.5.9* libncurses.so.5.9* libpanel.so.5.9* terminfo/libcurses.so* libform_g.a libmenu_g.a libncurses_g.a libpanel_g.a umconfig.txtlibform.a libmenu.a libncurses.a libpanel.a libtinfo.so@ vim*# 运行效果见下图

make CC=arm-linux-gnueabihf-gccterm.c:33:23: fatal error: termcap.h: 没有那个文件或目录compilation terminated.Makefile:2724: recipe for target 'objects/term.o' failedmake: *** [objects/term.o] Error 1若出现上面的错误是因为vim依赖库libtinfo,libtinfo而已经包含在libncurses的库里面了,所以要先交叉编译ncurses。
以上内容有笔者自己编写,也有摘自互联网。摘自互联网部分笔者都会仔细阅读,确保符合笔者当时测试情况进行编写,当然在学习的过程中不可避免的有理解不到位的地方,还请读友批评指正。
                    支付宝                                                         微信