@cyysu
2018-08-10T01:20:57.000000Z
字数 13821
阅读 1763
- 时间: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 lib
ln -s libncurses.so.5 libtinfo.so.5
ln -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/lib
configure: creating cache auto/config.cache
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for library containing strerror... none required
checking for gawk... gawk
checking for strip... strip
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking --enable-fail-if-missing argument... no
configure: checking for buggy tools...
checking for BeOS... no
checking for QNX... no
checking for Darwin (Mac OS X)... no
checking --with-local-dir argument... Defaulting to /usr/local
checking --with-vim-name argument... Defaulting to vim
checking --with-ex-name argument... Defaulting to ex
checking --with-view-name argument... Defaulting to view
checking --with-global-runtime argument... no
checking --with-modified-by argument... no
checking if character set is EBCDIC... no
checking --disable-selinux argument... yes
checking --with-features argument... tiny
checking --with-compiledby argument... no
checking --disable-xsmp argument... no
checking --disable-xsmp-interact argument... no
checking --enable-luainterp argument... no
checking --enable-mzschemeinterp argument... no
checking --enable-perlinterp argument... no
checking --enable-pythoninterp argument... no
checking --enable-python3interp argument... no
checking --enable-tclinterp argument... no
checking --enable-rubyinterp argument... no
checking --enable-cscope argument... no
checking --enable-workshop argument... no
checking --disable-netbeans argument... no
checking for socket in -lsocket... no
checking for gethostbyname in -lnsl... yes
checking whether compiling netbeans integration is possible... yes
checking --enable-sniff argument... no
checking --enable-multibyte argument... no
checking --enable-hangulinput argument... no
checking --enable-xim argument... defaulting to auto
checking --enable-fontset argument... no
defaulting to: don't HAVE_X11
checking --enable-gui argument... no GUI support
checking X11/SM/SMlib.h usability... yes
checking X11/SM/SMlib.h presence... yes
checking for X11/SM/SMlib.h... yes
checking for CYGWIN environment... no
checking whether toupper is broken... no
checking whether __DATE__ and __TIME__ work... yes
checking whether __attribute__((unused)) is allowed... yes
checking elf.h usability... yes
checking elf.h presence... yes
checking for elf.h... yes
checking for main in -lelf... no
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking stdint.h usability... yes
checking stdint.h presence... yes
checking for stdint.h... yes
checking stdlib.h usability... yes
checking stdlib.h presence... yes
checking for stdlib.h... yes
checking string.h usability... yes
checking string.h presence... yes
checking for string.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/utsname.h usability... yes
checking sys/utsname.h presence... yes
checking for sys/utsname.h... yes
checking termcap.h usability... yes
checking termcap.h presence... yes
checking for termcap.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sgtty.h usability... yes
checking sgtty.h presence... yes
checking for sgtty.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/types.h usability... yes
checking sys/types.h presence... yes
checking for sys/types.h... yes
checking termio.h usability... yes
checking termio.h presence... yes
checking for termio.h... yes
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking inttypes.h usability... yes
checking inttypes.h presence... yes
checking for inttypes.h... yes
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking unistd.h usability... yes
checking unistd.h presence... yes
checking for unistd.h... yes
checking stropts.h usability... yes
checking stropts.h presence... yes
checking for stropts.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking sys/systeminfo.h usability... no
checking sys/systeminfo.h presence... no
checking for sys/systeminfo.h... no
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking sys/stream.h usability... no
checking sys/stream.h presence... no
checking for sys/stream.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking libc.h usability... no
checking libc.h presence... no
checking for libc.h... no
checking sys/statfs.h usability... yes
checking sys/statfs.h presence... yes
checking for sys/statfs.h... yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/poll.h usability... yes
checking sys/poll.h presence... yes
checking for sys/poll.h... yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking utime.h usability... yes
checking utime.h presence... yes
checking for utime.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking libintl.h usability... yes
checking libintl.h presence... yes
checking for libintl.h... yes
checking libgen.h usability... yes
checking libgen.h presence... yes
checking for libgen.h... yes
checking util/debug.h usability... no
checking util/debug.h presence... no
checking for util/debug.h... no
checking util/msg18n.h usability... no
checking util/msg18n.h presence... no
checking for util/msg18n.h... no
checking frame.h usability... no
checking frame.h presence... no
checking for frame.h... no
checking sys/acl.h usability... no
checking sys/acl.h presence... no
checking for sys/acl.h... no
checking sys/access.h usability... no
checking sys/access.h presence... no
checking for sys/access.h... no
checking sys/sysinfo.h usability... yes
checking sys/sysinfo.h presence... yes
checking for sys/sysinfo.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking wctype.h usability... yes
checking wctype.h presence... yes
checking for wctype.h... yes
checking for sys/ptem.h... no
checking for sys/sysctl.h... yes
checking for pthread_np.h... no
checking strings.h usability... yes
checking strings.h presence... yes
checking for strings.h... yes
checking if strings.h can be included after string.h... yes
checking whether gcc needs -traditional... no
checking for an ANSI C-conforming const... yes
checking for working volatile... yes
checking for mode_t... yes
checking for off_t... yes
checking for pid_t... yes
checking for size_t... yes
checking for uid_t in sys/types.h... yes
checking for uint32_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for ino_t... yes
checking for dev_t... yes
checking whether byte ordering is bigendian... no
checking for rlim_t... yes
checking for stack_t... yes
checking whether stack_t has an ss_base field... no
checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... yes
checking whether we talk terminfo... yes
checking what tgetent() returns for an unknown terminal... zero
checking whether termcap.h contains ospeed... yes
checking whether termcap.h contains UP, BC and PC... yes
checking whether tputs() uses outfuntype... no
checking whether sys/select.h and sys/time.h may both be included... yes
checking for /dev/ptc... no
checking for SVR4 ptys... yes
checking for ptyranges... don't know
checking default tty permissions/group... can't determine - assume ptys are world accessible
world
checking return type of signal handlers... void
checking for struct sigcontext... yes
checking getcwd implementation is broken... no
checking for bcmp... yes
checking for fchdir... yes
checking for fchown... yes
checking for fsync... yes
checking for getcwd... yes
checking for getpseudotty... no
checking for getpwent... yes
checking for getpwnam... yes
checking for getpwuid... yes
checking for getrlimit... yes
checking for gettimeofday... yes
checking for getwd... yes
checking for lstat... yes
checking for memcmp... yes
checking for memset... yes
checking for mkdtemp... yes
checking for nanosleep... yes
checking for opendir... yes
checking for putenv... yes
checking for qsort... yes
checking for readlink... yes
checking for select... yes
checking for setenv... yes
checking for setpgid... yes
checking for setsid... yes
checking for sigaltstack... yes
checking for sigstack... yes
checking for sigset... yes
checking for sigsetjmp... no
checking for sigaction... yes
checking for sigvec... no
checking for strcasecmp... yes
checking for strerror... yes
checking for strftime... yes
checking for stricmp... no
checking for strncasecmp... yes
checking for strnicmp... no
checking for strpbrk... yes
checking for strtol... yes
checking for tgetent... yes
checking for towlower... yes
checking for towupper... yes
checking for iswupper... yes
checking for usleep... yes
checking for utime... yes
checking for utimes... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for st_blksize... yes
checking whether stat() ignores a trailing slash... no
checking for iconv_open()... yes
checking for nl_langinfo(CODESET)... yes
checking for strtod in -lm... yes
checking for strtod() and other floating point functions... yes
checking --disable-acl argument... yes
checking --disable-gpm argument... yes
checking --disable-sysmouse argument... no
checking for sysmouse... no
checking for FD_CLOEXEC... yes
checking for rename... yes
checking for sysctl... not usable
checking for sysinfo... yes
checking for sysinfo.mem_unit... yes
checking for sysconf... yes
checking size of int... 4
checking size of long... 8
checking size of time_t... 8
checking size of off_t... 8
checking uint32_t is 32 bits... ok
checking whether memmove handles overlaps... yes
checking for _xpg4_setrunelocale in -lxpg4... no
checking how to create tags... ctags -I INIT+ --fields=+S
checking how to run man with a section nr... man -s
checking --disable-nls argument... no
checking for msgfmt... msgfmt
checking for NLS... gettext() works
checking for bind_textdomain_codeset... yes
checking for _nl_msg_cat_cntr... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for dlopen()... no
checking for dlopen() in -ldl... yes
checking for dlsym()... yes
checking setjmp.h usability... yes
checking setjmp.h presence... yes
checking for setjmp.h... yes
checking for GCC 3 or later... yes
checking whether we need -D_FORTIFY_SOURCE=1... yes
checking linker --as-needed support... yes
configure: updating cache auto/config.cache
configure: creating auto/config.status
config.status: creating auto/config.mk
config.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.po
1869 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o sk.mo sk.po
1628 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o sv.mo sv.po
1697 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o uk.mo uk.po
1819 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o vi.mo vi.po
1422 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_CN.UTF-8.mo zh_CN.UTF-8.po
1634 条已翻译消息,3 条模糊消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_CN.mo zh_CN.po
1633 条已翻译消息,3 条模糊消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_TW.UTF-8.mo zh_TW.UTF-8.po
1422 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_TW.mo zh_TW.po
1422 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o cs.cp1250.mo cs.cp1250.po
1284 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o ja.sjis.mo ja.sjis.po
1869 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o ja.euc-jp.mo ja.euc-jp.po
1869 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o pl.cp1250.mo pl.cp1250.po
1869 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o pl.UTF-8.mo pl.UTF-8.po
1869 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o ru.cp1251.mo ru.cp1251.po
1869 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o sk.cp1250.mo sk.cp1250.po
1628 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o uk.cp1251.mo uk.cp1251.po
1819 条已翻译消息.
OLD_PO_FILE_INPUT=yes msgfmt -v -o zh_CN.cp936.mo zh_CN.cp936.po
1633 条已翻译消息,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 vim
vim: 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.5
ln -s libtinfo.so.5 libtinfo.so
root@DZ:/home/mj/htop_arm/vim74/src# scp vim root@master:/tmp
root@master's password:
vim 100% 1911KB 1.9MB/s 00:00
# 嵌入式ARM端
[root@3352-T tmp]# ls
dbus/ 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.conf
libcurses.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.txt
libform.a libmenu.a libncurses.a libpanel.a libtinfo.so@ vim*
# 运行效果见下图
make CC=arm-linux-gnueabihf-gcc
term.c:33:23: fatal error: termcap.h: 没有那个文件或目录
compilation terminated.
Makefile:2724: recipe for target 'objects/term.o' failed
make: *** [objects/term.o] Error 1
若出现上面的错误是因为vim依赖库libtinfo,libtinfo而已经包含在libncurses的库里面了,所以要先交叉编译ncurses。
以上内容有笔者自己编写,也有摘自互联网。摘自互联网部分笔者都会仔细阅读,确保符合笔者当时测试情况进行编写,当然在学习的过程中不可避免的有理解不到位的地方,还请读友批评指正。
支付宝 微信