[关闭]
@cyysu 2018-08-10T01:22:28.000000Z 字数 30466 阅读 2080

嵌入式ARM-htop移植教程

  • 时间:2017年11月15日14:22:40
  • 作者:Kali
  • 邮箱:cyysu.github.io@gmail.com/2869905223@qq.com/微信lwyx1413
  • 版本:4.0
  • 描述:在ARM平台移植htop

Linux字符界面系列教程


移植过程

  1. 在移植之前需要下载ncurse软件包,他提供了字符界面常用的库 
  2. tar xf ncurses.tar.gz
  3. tar xf htop-1.0.2.tar.gz
  4. mkdir install_ncurses
  5. mkdir install_htop
  6.   
  7. 编译ncurses,由于htop依赖于ncurses库,因此需要先编译ncurses,进入ncurses目录,并配置交叉编译
  8. cd ncurses-5.9
  9. root@DZ:/home/mj/htop_arm/ncurses-5.9# ./configure --prefix=/home/mj/install_ncurses --host=arm-none-linux-gnueabi --without-cxx --without-cxx-binding --without-ada --without-manpages --enable-overwrite --without-debug --without-tests --with-shared --without-tests --without-progs
  10. configure: WARNING: If you wanted to set the --build type, don't use --host.
  11. If a cross compiler is detected then cross compile mode will be used.
  12. checking for egrep... grep -E
  13. Configuring NCURSES 5.9 ABI 5 (Wed Nov 15 15:22:39 CST 2017)
  14. checking build system type... x86_64-unknown-linux-gnu
  15. checking host system type... arm-none-linux-gnueabi
  16. checking target system type... arm-none-linux-gnueabi
  17. Configuring for linux-gnueabi
  18. checking for prefix... /home/mj/install_ncurses
  19. checking for arm-none-linux-gnueabi-gcc... arm-none-linux-gnueabi-gcc
  20. checking for C compiler default output... a.out
  21. checking whether the C compiler works... yes
  22. checking whether we are cross compiling... yes
  23. checking for executable suffix...
  24. checking for object suffix... o
  25. checking whether we are using the GNU C compiler... yes
  26. checking whether arm-none-linux-gnueabi-gcc accepts -g... yes
  27. checking version of arm-none-linux-gnueabi-gcc... 2011.03
  28. checking how to run the C preprocessor... arm-none-linux-gnueabi-gcc -E
  29. checking whether arm-none-linux-gnueabi-gcc needs -traditional... no
  30. checking whether arm-none-linux-gnueabi-gcc understands -c and -o together... yes
  31. checking for POSIXized ISC... no
  32. checking for arm-none-linux-gnueabi-gcc option to accept ANSI C... -DCC_HAS_PROTOS
  33. checking if you want to ensure bool is consistent with C++... no
  34. checking if you want to build C++ binding and demo... no
  35. checking if you want to build with Ada95... no
  36. checking if you want to install manpages... no
  37. checking if you want to build programs such as tic... no
  38. checking if you want to build test-programs... no
  39. checking if you wish to install curses.h... yes
  40. checking for mawk... mawk
  41. checking for egrep... (cached) grep -E
  42. checking for a BSD compatible install... /usr/bin/install -c
  43. checking for tdlint... no
  44. checking for lint... no
  45. checking for alint... no
  46. checking for splint... no
  47. checking for lclint... no
  48. checking whether ln -s works... yes
  49. checking if ln -s -f options work... yes
  50. checking for long file names... yes
  51. checking if you want to use pkg-config... yes
  52. checking for arm-none-linux-gnueabi-pkg-config... no
  53. checking for pkg-config... /usr/bin/pkg-config
  54. checking if we should install .pc files for /usr/bin/pkg-config... no
  55. checking if we should assume mixed-case filenames... auto
  56. checking if filesystem supports mixed-case filenames... yes
  57. checking whether make sets ${MAKE}... yes
  58. checking for exctags... no
  59. checking for ctags... ctags
  60. checking for exetags... no
  61. checking for etags... etags
  62. checking for ctags... yes
  63. checking for etags... yes
  64. checking for makeflags variable...
  65. checking for arm-none-linux-gnueabi-ranlib... arm-none-linux-gnueabi-ranlib
  66. checking for arm-none-linux-gnueabi-ld... arm-none-linux-gnueabi-ld
  67. checking for arm-none-linux-gnueabi-ar... arm-none-linux-gnueabi-ar
  68. checking for arm-none-linux-gnueabi-ar... (cached) arm-none-linux-gnueabi-ar
  69. checking for options to update archives... -curv
  70. checking if you have specified an install-prefix...
  71. checking for gcc... gcc
  72. checking for native build C compiler... gcc
  73. checking for native build C preprocessor... ${BUILD_CC} -E
  74. checking for native build C flags...
  75. checking for native build C preprocessor-flags...
  76. checking for native build linker-flags...
  77. checking for native build linker-libraries...
  78. checking if libtool -version-number should be used... yes
  79. checking if you want to build libraries with libtool... no
  80. checking if you want to build shared libraries... yes
  81. checking if you want to build static libraries... yes
  82. checking if you want to build debug libraries... no
  83. checking if you want to build profiling libraries... no
  84. checking for specified models... shared normal
  85. checking for default model... shared
  86. checking if you want to build a separate terminfo library... no
  87. checking if you want to build a separate tic library... no
  88. checking if you want to link with the GPM mouse library... maybe
  89. checking for gpm.h... no
  90. checking for default loader flags...
  91. checking if rpath option should be used... no
  92. checking if shared libraries should be relinked during install... yes
  93. checking for an rpath option... -Wl,-rpath,
  94. checking if release/abi version should be used for shared libs... auto
  95. checking which arm-none-linux-gnueabi-gcc option to use... -fPIC
  96. checking if rpath-hack should be disabled... no
  97. checking for updated LDFLAGS... maybe
  98. checking for ldd... ldd
  99. checking if you wish to install ncurses overwriting curses... yes
  100. checking if external terminfo-database is used... yes
  101. checking which terminfo source-file will be installed... ${top_srcdir}/misc/terminfo.src
  102. checking whether to use hashed database instead of directory/tree... no
  103. checking for list of fallback descriptions...
  104. checking if you want modern xterm or antique... xterm-new
  105. checking for list of terminfo directories... /home/mj/install_ncurses/share/terminfo
  106. checking for default terminfo directory... /home/mj/install_ncurses/share/terminfo
  107. checking if big-core option selected... no
  108. checking if big-strings option selected... yes
  109. checking if you want termcap-fallback support... no
  110. checking if ~/.terminfo is wanted... yes
  111. checking if you want to use restricted environment when running as root... yes
  112. checking for remove... yes
  113. checking for unlink... yes
  114. checking for link... yes
  115. checking for symlink... yes
  116. checking if tic should use symbolic links... no
  117. checking if tic should use hard links... yes
  118. checking if you want broken-linker support code... no
  119. checking if tputs should process BSD-style prefix padding... no
  120. checking if we must define _GNU_SOURCE... yes
  121. checking if SIGWINCH is defined... yes
  122. checking for nl_langinfo and CODESET... yes
  123. checking if you want wide-character code... no
  124. checking whether to enable _LP64 definition in curses.h... no
  125. checking for special C compiler options needed for large files... no
  126. checking for _FILE_OFFSET_BITS value needed for large files... 64
  127. checking for _LARGE_FILES value needed for large files... no
  128. checking for _LARGEFILE_SOURCE value needed for large files... no
  129. checking for fseeko... yes
  130. checking whether to use struct dirent64... no
  131. checking if you want tparm not to use X/Open fixed-parameter list... yes
  132. checking for type of bool... auto
  133. checking for alternate terminal capabilities file... Caps
  134. checking for type of chtype... auto
  135. checking for type of ospeed... short
  136. checking for type of mmask_t... auto
  137. checking for size CCHARW_MAX... 5
  138. checking if RCS identifiers should be compiled-in... no
  139. checking format of man-pages... gzip
  140. checking for manpage renaming... /home/mj/htop_arm/ncurses-5.9/man/man_db.renames
  141. checking if manpage aliases will be installed... yes
  142. checking if manpage symlinks should be used... yes
  143. checking for manpage tbl... no
  144. checking if you want to build with function extensions... yes
  145. checking if you want to build with experimental SCREEN extensions... no
  146. checking if you want to build with experimental terminal-driver... no
  147. checking for extended use of const keyword... no
  148. checking if you want to use extended colors... no
  149. checking if you want to use extended mouse encoding... no
  150. checking if you want $NCURSES_NO_PADDING code... yes
  151. checking for ANSI C header files... yes
  152. checking for sys/types.h... yes
  153. checking for sys/stat.h... yes
  154. checking for stdlib.h... yes
  155. checking for string.h... yes
  156. checking for memory.h... yes
  157. checking for strings.h... yes
  158. checking for inttypes.h... yes
  159. checking for stdint.h... yes
  160. checking for unistd.h... yes
  161. checking for signed char... yes
  162. checking size of signed char... 1
  163. checking if you want to use signed Boolean array in term.h... no
  164. checking if you want SIGWINCH handler... yes
  165. checking if you want user-definable terminal capabilities like termcap... yes
  166. checking if you want all development code... no
  167. checking if you want hard-tabs code... no
  168. checking if you want limited support for xmc... no
  169. checking if you do not want to assume colors are white-on-black... yes
  170. checking if you want hashmap scrolling-optimization code... yes
  171. checking if you want colorfgbg code... no
  172. checking if you want interop bindings... no
  173. checking if you want to link with the pthread library... no
  174. checking if you want experimental reentrant code... no
  175. checking if you want experimental safe-sprintf code... no
  176. checking if you want experimental wgetch-events code... no
  177. checking if you want to display full commands during build... yes
  178. checking if you want to see compiler warnings...
  179. configure: checking for arm-none-linux-gnueabi-gcc __attribute__ directives...
  180. ... scanf
  181. ... printf
  182. ... unused
  183. ... noreturn
  184. checking if you want to enable runtime assertions... no
  185. checking if you want to use dmalloc for testing... no
  186. checking if you want to use dbmalloc for testing... no
  187. checking if you want to use valgrind for testing... no
  188. checking if you want to perform memory-leak testing... no
  189. checking whether to add trace feature to all models... no
  190. checking for gettimeofday... yes
  191. checking if -lm needed for math functions... yes
  192. checking for ANSI C header files... (cached) yes
  193. checking for dirent.h that defines DIR... yes
  194. checking for opendir in -ldir... no
  195. checking whether time.h and sys/time.h may both be included... yes
  196. checking for regcomp... yes
  197. checking for regular-expression headers... regex.h
  198. checking for fcntl.h... yes
  199. checking for getopt.h... yes
  200. checking for limits.h... yes
  201. checking for locale.h... yes
  202. checking for math.h... yes
  203. checking for poll.h... yes
  204. checking for sys/bsdtypes.h... no
  205. checking for sys/ioctl.h... yes
  206. checking for sys/param.h... yes
  207. checking for sys/poll.h... yes
  208. checking for sys/select.h... yes
  209. checking for sys/time.h... yes
  210. checking for sys/times.h... yes
  211. checking for ttyent.h... yes
  212. checking for unistd.h... (cached) yes
  213. checking for wctype.h... yes
  214. checking if sys/time.h works with sys/select.h... yes
  215. checking for arm-none-linux-gnueabi-gcc option to accept ANSI C... none needed
  216. checking for an ANSI C-conforming const... yes
  217. checking for inline... inline
  218. checking if arm-none-linux-gnueabi-gcc supports options to tune inlining... yes
  219. checking for signal global datatype... volatile sig_atomic_t
  220. checking for type of chtype... long
  221. checking if unsigned literals are legal... yes
  222. checking if external errno is declared... yes
  223. checking if external errno exists... no
  224. checking if data-only library module links... unknown
  225. checking for getcwd... yes
  226. checking for getegid... yes
  227. checking for geteuid... yes
  228. checking for getttynam... yes
  229. checking for issetugid... no
  230. checking for poll... yes
  231. checking for remove... (cached) yes
  232. checking for select... yes
  233. checking for setbuf... yes
  234. checking for setbuffer... yes
  235. checking for setvbuf... yes
  236. checking for sigaction... yes
  237. checking for sigvec... yes
  238. checking for strdup... yes
  239. checking for strstr... yes
  240. checking for tcgetpgrp... yes
  241. checking for times... yes
  242. checking for vsnprintf... yes
  243. checking for isascii... yes
  244. checking whether sigaction needs _POSIX_SOURCE... no
  245. checking if nanosleep really works... unknown
  246. checking for termio.h... yes
  247. checking for termios.h... yes
  248. checking for unistd.h... (cached) yes
  249. checking whether termios.h needs _POSIX_SOURCE... no
  250. checking for tcgetattr... yes
  251. checking for vsscanf function or workaround... vsscanf
  252. checking for working mkstemp... checking for mkstemp... yes
  253. configure: WARNING: cross compiling: assume setvbuf params not reversed
  254. checking return type of signal handlers... void
  255. checking for type sigaction_t... no
  256. checking declaration of size-change... yes
  257. checking for memmove... yes
  258. checking if poll really works... unknown
  259. checking for va_copy... yes
  260. checking for __va_copy... yes
  261. checking for pid_t... yes
  262. checking for unistd.h... (cached) yes
  263. checking for vfork.h... no
  264. checking for fork... yes
  265. checking for vfork... yes
  266. checking for working fork... (cached) yes
  267. checking for working vfork... (cached) yes
  268. checking for openpty in -lutil... yes
  269. checking for openpty header... pty.h
  270. checking if we should include stdbool.h... yes
  271. checking for builtin bool type... no
  272. checking for size of bool... unknown
  273. configure: WARNING: Assuming unsigned for type of bool
  274. checking for library subsets... termlib+ext_tinfo+base+ext_funcs
  275. checking default library suffix...
  276. checking default library-dependency suffix... .so
  277. checking default object directory... obj_s
  278. checking where we will install curses.h... ${prefix}/include
  279. checking for src modules... ncurses panel menu form
  280. checking for tic... /usr/bin/tic
  281. configure: creating ./config.status
  282. config.status: creating include/MKterm.h.awk
  283. config.status: creating include/curses.head
  284. config.status: creating include/ncurses_dll.h
  285. config.status: creating include/termcap.h
  286. config.status: creating include/unctrl.h
  287. config.status: creating include/Makefile
  288. config.status: creating ncurses/Makefile
  289. config.status: creating panel/Makefile
  290. config.status: creating menu/Makefile
  291. config.status: creating form/Makefile
  292. config.status: creating misc/Makefile
  293. config.status: creating misc/run_tic.sh
  294. config.status: creating misc/ncurses-config
  295. config.status: creating man/ncurses5-config.1
  296. config.status: creating Makefile
  297. config.status: creating include/ncurses_cfg.h
  298. Appending rules for shared model (ncurses: termlib+ext_tinfo+base+ext_funcs)
  299. Appending rules for normal model (ncurses: termlib+ext_tinfo+base+ext_funcs)
  300. Appending rules for shared model (panel: termlib+ext_tinfo+base+ext_funcs)
  301. Appending rules for normal model (panel: termlib+ext_tinfo+base+ext_funcs)
  302. Appending rules for shared model (menu: termlib+ext_tinfo+base+ext_funcs)
  303. Appending rules for normal model (menu: termlib+ext_tinfo+base+ext_funcs)
  304. Appending rules for shared model (form: termlib+ext_tinfo+base+ext_funcs)
  305. Appending rules for normal model (form: termlib+ext_tinfo+base+ext_funcs)
  306. creating headers.sh
  307. ** Configuration summary for NCURSES 5.9 20110404:
  308. extended funcs: yes
  309. xterm terminfo: xterm-new
  310. bin directory: /home/mj/install_ncurses/bin
  311. lib directory: /home/mj/install_ncurses/lib
  312. include directory: /home/mj/install_ncurses/include
  313. man directory: /home/mj/install_ncurses/man
  314. terminfo directory: /home/mj/install_ncurses/share/terminfo
  315. # 直接进行安装操作
  316. root@DZ:/home/mj/htop_arm/ncurses-5.9# make && make install
  317. cd include && make DESTDIR="" all
  318. make[1]: Entering directory '/home/mj/htop_arm/ncurses-5.9/include'
  319. cat curses.head >curses.h
  320. AWK=mawk sh ./MKkey_defs.sh ./Caps >>curses.h
  321. sh -c 'if test "chtype" = "cchar_t" ; then cat ./curses.wide >>curses.h ; fi'
  322. cat ./curses.tail >>curses.h
  323. sh ./MKhashsize.sh ./Caps >hashsize.h
  324. AWK=mawk sh ./MKncurses_def.sh ./ncurses_defs >ncurses_def.h
  325. AWK=mawk sh ./MKparametrized.sh ./Caps >parametrized.h
  326. touch config.h
  327. mawk -f MKterm.h.awk ./Caps > term.h
  328. sh ./edit_cfg.sh ../include/ncurses_cfg.h term.h
  329. ** edit: HAVE_TCGETATTR 1
  330. ** edit: HAVE_TERMIOS_H 1
  331. ** edit: HAVE_TERMIO_H 1
  332. ** edit: BROKEN_LINKER 0
  333. ....
  334. ....
  335. /bin/sh ./run_tic.sh
  336. ** Building terminfo database, please wait...
  337. Running /usr/bin/tic to install /home/mj/install_ncurses/share/terminfo ...
  338. You may see messages regarding extended capabilities, e.g., AX.
  339. These are extended terminal capabilities which are compiled
  340. using
  341. tic -x
  342. If you have ncurses 4.2 applications, you should read the INSTALL
  343. document, and install the terminfo without the -x option.
  344. 1600 entries written to /home/mj/install_ncurses/share/terminfo
  345. ** built new /home/mj/install_ncurses/share/terminfo
  346. ** sym-linked /home/mj/install_ncurses/lib/terminfo for compatibility
  347. installing std
  348. installing stdcrt
  349. installing vt100
  350. installing vt300
  351. /usr/bin/install -c ncurses-config /home/mj/install_ncurses/bin/ncurses5-config
  352. make[1]: Leaving directory '/home/mj/htop_arm/ncurses-5.9/misc'
  353. # 安装完测试结果
  354. root@DZ:/home/mj/install_ncurses# ls
  355. bin include lib share
  356. root@DZ:/home/mj/install_ncurses# pwd
  357. /home/mj/install_ncurses

htop编译

  1. 接下来就是编译htop,进入htop目录,并配置htop交叉编译选项,注意需通过LDFLAGS指定ncurses库所在的目录并通过CPPFLAGS指定ncurses头文件所在的目录
  2. root@DZ:/home/mj/install_ncurses# cd ../htop_arm/htop-1.0.2/
  3. root@DZ:/home/mj/htop_arm/htop-1.0.2# ./configure --prefix=/home/mj/install_htop --disable-unicode --host=arm-none-linux-gnueabi LDFLAGS=-L/home/mj/install_ncurses/lib CPPFLAGS=-I/home/mj/install_ncurses/include/ncurses
  4. configure: WARNING: If you wanted to set the --build type, don't use --host.
  5. If a cross compiler is detected then cross compile mode will be used.
  6. checking for arm-none-linux-gnueabi-gcc... arm-none-linux-gnueabi-gcc
  7. checking whether the C compiler works... yes
  8. checking for C compiler default output file name... a.out
  9. checking for suffix of executables...
  10. checking whether we are cross compiling... yes
  11. checking for suffix of object files... o
  12. checking whether we are using the GNU C compiler... yes
  13. checking whether arm-none-linux-gnueabi-gcc accepts -g... yes
  14. checking for arm-none-linux-gnueabi-gcc option to accept ISO C89... none needed
  15. checking how to run the C preprocessor... arm-none-linux-gnueabi-gcc -E
  16. checking for grep that handles long lines and -e... /bin/grep
  17. checking for egrep... /bin/grep -E
  18. checking for ANSI C header files... yes
  19. checking for sys/types.h... yes
  20. checking for sys/stat.h... yes
  21. checking for stdlib.h... yes
  22. checking for string.h... yes
  23. checking for memory.h... yes
  24. checking for strings.h... yes
  25. checking for inttypes.h... yes
  26. checking for stdint.h... yes
  27. checking for unistd.h... yes
  28. checking minix/config.h usability... no
  29. checking minix/config.h presence... no
  30. checking for minix/config.h... no
  31. checking whether it is safe to define __EXTENSIONS__... yes
  32. checking build system type... x86_64-unknown-linux-gnu
  33. checking host system type... arm-none-linux-gnueabi
  34. checking target system type... arm-none-linux-gnueabi
  35. checking for a BSD-compatible install... /usr/bin/install -c
  36. checking whether build environment is sane... yes
  37. checking for arm-none-linux-gnueabi-strip... arm-none-linux-gnueabi-strip
  38. checking for a thread-safe mkdir -p... /bin/mkdir -p
  39. checking for gawk... gawk
  40. checking whether make sets $(MAKE)... yes
  41. checking for style of include used by make... GNU
  42. checking dependency style of arm-none-linux-gnueabi-gcc... gcc3
  43. checking for arm-none-linux-gnueabi-gcc... (cached) arm-none-linux-gnueabi-gcc
  44. checking whether we are using the GNU C compiler... (cached) yes
  45. checking whether arm-none-linux-gnueabi-gcc accepts -g... (cached) yes
  46. checking for arm-none-linux-gnueabi-gcc option to accept ISO C89... (cached) none needed
  47. checking whether arm-none-linux-gnueabi-gcc and cc understand -c and -o together... yes
  48. checking how to print strings... printf
  49. checking for a sed that does not truncate output... /bin/sed
  50. checking for fgrep... /bin/grep -F
  51. checking for ld used by arm-none-linux-gnueabi-gcc... /opt/arm-2011.03/arm-none-linux-gnueabi/bin/ld
  52. checking if the linker (/opt/arm-2011.03/arm-none-linux-gnueabi/bin/ld) is GNU ld... yes
  53. checking for BSD- or MS-compatible name lister (nm)... /opt/arm-2011.03/bin/arm-none-linux-gnueabi-nm -B
  54. checking the name lister (/opt/arm-2011.03/bin/arm-none-linux-gnueabi-nm -B) interface... BSD nm
  55. checking whether ln -s works... yes
  56. checking the maximum length of command line arguments... 1572864
  57. checking whether the shell understands some XSI constructs... yes
  58. checking whether the shell understands "+="... yes
  59. checking for /opt/arm-2011.03/arm-none-linux-gnueabi/bin/ld option to reload object files... -r
  60. checking for arm-none-linux-gnueabi-objdump... arm-none-linux-gnueabi-objdump
  61. checking how to recognize dependent libraries... pass_all
  62. checking for arm-none-linux-gnueabi-ar... arm-none-linux-gnueabi-ar
  63. checking for arm-none-linux-gnueabi-strip... (cached) arm-none-linux-gnueabi-strip
  64. checking for arm-none-linux-gnueabi-ranlib... arm-none-linux-gnueabi-ranlib
  65. checking command to parse /opt/arm-2011.03/bin/arm-none-linux-gnueabi-nm -B output from arm-none-linux-gnueabi-gcc object... ok
  66. checking for dlfcn.h... yes
  67. checking for objdir... .libs
  68. checking if arm-none-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no
  69. checking for arm-none-linux-gnueabi-gcc option to produce PIC... -fPIC -DPIC
  70. checking if arm-none-linux-gnueabi-gcc PIC flag -fPIC -DPIC works... yes
  71. checking if arm-none-linux-gnueabi-gcc static flag -static works... yes
  72. checking if arm-none-linux-gnueabi-gcc supports -c -o file.o... yes
  73. checking if arm-none-linux-gnueabi-gcc supports -c -o file.o... (cached) yes
  74. checking whether the arm-none-linux-gnueabi-gcc linker (/opt/arm-2011.03/arm-none-linux-gnueabi/bin/ld) supports shared libraries... yes
  75. checking dynamic linker characteristics... GNU/Linux ld.so
  76. checking how to hardcode library paths into programs... immediate
  77. checking whether stripping libraries is possible... yes
  78. checking if libtool supports shared libraries... yes
  79. checking whether to build shared libraries... no
  80. checking whether to build static libraries... yes
  81. checking for ceil in -lm... yes
  82. checking for dirent.h that defines DIR... yes
  83. checking for library containing opendir... none required
  84. checking for ANSI C header files... (cached) yes
  85. checking for stdlib.h... (cached) yes
  86. checking for string.h... (cached) yes
  87. checking for strings.h... (cached) yes
  88. checking sys/param.h usability... yes
  89. checking sys/param.h presence... yes
  90. checking for sys/param.h... yes
  91. checking sys/time.h usability... yes
  92. checking sys/time.h presence... yes
  93. checking for sys/time.h... yes
  94. checking for unistd.h... (cached) yes
  95. checking curses.h usability... no
  96. checking curses.h presence... no
  97. checking for curses.h... no
  98. checking execinfo.h usability... yes
  99. checking execinfo.h presence... yes
  100. checking for execinfo.h... yes
  101. checking for stdbool.h that conforms to C99... yes
  102. checking for _Bool... yes
  103. checking for an ANSI C-conforming const... yes
  104. checking for pid_t... yes
  105. checking for uid_t in sys/types.h... yes
  106. checking whether closedir returns void... yes
  107. checking return type of signal handlers... void
  108. checking whether lstat correctly handles trailing slash... no
  109. checking whether stat accepts an empty string... yes
  110. checking for memmove... yes
  111. checking for strncasecmp... yes
  112. checking for strstr... yes
  113. checking for strdup... yes
  114. checking whether gcc -std=c99 option works... yes
  115. checking for refresh in -lncurses... yes
  116. checking for curses.h... (cached) no
  117. configure: error: missing headers: curses.h curses.h
  118. root@DZ:/home/mj/htop_arm/htop-1.0.2# ./configure --prefix=/home/mj/install_htop --disable-unicode --host=arm-none-linux-gnueabi LDFLAGS=-L/home/mj/install_ncurses/lib CPPFLAGS=-I/home/mj/install_ncurses/includeconfigure: WARNING: If you wanted to set the --build type, don't use --host.
  119. If a cross compiler is detected then cross compile mode will be used.
  120. checking for arm-none-linux-gnueabi-gcc... arm-none-linux-gnueabi-gcc
  121. checking whether the C compiler works... yes
  122. checking for C compiler default output file name... a.out
  123. checking for suffix of executables...
  124. checking whether we are cross compiling... yes
  125. checking for suffix of object files... o
  126. checking whether we are using the GNU C compiler... yes
  127. checking whether arm-none-linux-gnueabi-gcc accepts -g... yes
  128. checking for arm-none-linux-gnueabi-gcc option to accept ISO C89... none needed
  129. checking how to run the C preprocessor... arm-none-linux-gnueabi-gcc -E
  130. checking for grep that handles long lines and -e... /bin/grep
  131. checking for egrep... /bin/grep -E
  132. checking for ANSI C header files... yes
  133. checking for sys/types.h... yes
  134. checking for sys/stat.h... yes
  135. checking for stdlib.h... yes
  136. checking for string.h... yes
  137. checking for memory.h... yes
  138. checking for strings.h... yes
  139. checking for inttypes.h... yes
  140. checking for stdint.h... yes
  141. checking for unistd.h... yes
  142. checking minix/config.h usability... no
  143. checking minix/config.h presence... no
  144. checking for minix/config.h... no
  145. checking whether it is safe to define __EXTENSIONS__... yes
  146. checking build system type... x86_64-unknown-linux-gnu
  147. checking host system type... arm-none-linux-gnueabi
  148. checking target system type... arm-none-linux-gnueabi
  149. checking for a BSD-compatible install... /usr/bin/install -c
  150. checking whether build environment is sane... yes
  151. checking for arm-none-linux-gnueabi-strip... arm-none-linux-gnueabi-strip
  152. checking for a thread-safe mkdir -p... /bin/mkdir -p
  153. checking for gawk... gawk
  154. checking whether make sets $(MAKE)... yes
  155. checking for style of include used by make... GNU
  156. checking dependency style of arm-none-linux-gnueabi-gcc... gcc3
  157. checking for arm-none-linux-gnueabi-gcc... (cached) arm-none-linux-gnueabi-gcc
  158. checking whether we are using the GNU C compiler... (cached) yes
  159. checking whether arm-none-linux-gnueabi-gcc accepts -g... (cached) yes
  160. checking for arm-none-linux-gnueabi-gcc option to accept ISO C89... (cached) none needed
  161. checking whether arm-none-linux-gnueabi-gcc and cc understand -c and -o together... yes
  162. checking how to print strings... printf
  163. checking for a sed that does not truncate output... /bin/sed
  164. checking for fgrep... /bin/grep -F
  165. checking for ld used by arm-none-linux-gnueabi-gcc... /opt/arm-2011.03/arm-none-linux-gnueabi/bin/ld
  166. checking if the linker (/opt/arm-2011.03/arm-none-linux-gnueabi/bin/ld) is GNU ld... yes
  167. checking for BSD- or MS-compatible name lister (nm)... /opt/arm-2011.03/bin/arm-none-linux-gnueabi-nm -B
  168. checking the name lister (/opt/arm-2011.03/bin/arm-none-linux-gnueabi-nm -B) interface... BSD nm
  169. checking whether ln -s works... yes
  170. checking the maximum length of command line arguments... 1572864
  171. checking whether the shell understands some XSI constructs... yes
  172. checking whether the shell understands "+="... yes
  173. checking for /opt/arm-2011.03/arm-none-linux-gnueabi/bin/ld option to reload object files... -r
  174. checking for arm-none-linux-gnueabi-objdump... arm-none-linux-gnueabi-objdump
  175. checking how to recognize dependent libraries... pass_all
  176. checking for arm-none-linux-gnueabi-ar... arm-none-linux-gnueabi-ar
  177. checking for arm-none-linux-gnueabi-strip... (cached) arm-none-linux-gnueabi-strip
  178. checking for arm-none-linux-gnueabi-ranlib... arm-none-linux-gnueabi-ranlib
  179. checking command to parse /opt/arm-2011.03/bin/arm-none-linux-gnueabi-nm -B output from arm-none-linux-gnueabi-gcc object... ok
  180. checking for dlfcn.h... yes
  181. checking for objdir... .libs
  182. checking if arm-none-linux-gnueabi-gcc supports -fno-rtti -fno-exceptions... no
  183. checking for arm-none-linux-gnueabi-gcc option to produce PIC... -fPIC -DPIC
  184. checking if arm-none-linux-gnueabi-gcc PIC flag -fPIC -DPIC works... yes
  185. checking if arm-none-linux-gnueabi-gcc static flag -static works... yes
  186. checking if arm-none-linux-gnueabi-gcc supports -c -o file.o... yes
  187. checking if arm-none-linux-gnueabi-gcc supports -c -o file.o... (cached) yes
  188. checking whether the arm-none-linux-gnueabi-gcc linker (/opt/arm-2011.03/arm-none-linux-gnueabi/bin/ld) supports shared libraries... yes
  189. checking dynamic linker characteristics... GNU/Linux ld.so
  190. checking how to hardcode library paths into programs... immediate
  191. checking whether stripping libraries is possible... yes
  192. checking if libtool supports shared libraries... yes
  193. checking whether to build shared libraries... no
  194. checking whether to build static libraries... yes
  195. checking for ceil in -lm... yes
  196. checking for dirent.h that defines DIR... yes
  197. checking for library containing opendir... none required
  198. checking for ANSI C header files... (cached) yes
  199. checking for stdlib.h... (cached) yes
  200. checking for string.h... (cached) yes
  201. checking for strings.h... (cached) yes
  202. checking sys/param.h usability... yes
  203. checking sys/param.h presence... yes
  204. checking for sys/param.h... yes
  205. checking sys/time.h usability... yes
  206. checking sys/time.h presence... yes
  207. checking for sys/time.h... yes
  208. checking for unistd.h... (cached) yes
  209. checking curses.h usability... yes
  210. checking curses.h presence... yes
  211. checking for curses.h... yes
  212. checking execinfo.h usability... yes
  213. checking execinfo.h presence... yes
  214. checking for execinfo.h... yes
  215. checking for stdbool.h that conforms to C99... yes
  216. checking for _Bool... yes
  217. checking for an ANSI C-conforming const... yes
  218. checking for pid_t... yes
  219. checking for uid_t in sys/types.h... yes
  220. checking whether closedir returns void... yes
  221. checking return type of signal handlers... void
  222. checking whether lstat correctly handles trailing slash... no
  223. checking whether stat accepts an empty string... yes
  224. checking for memmove... yes
  225. checking for strncasecmp... yes
  226. checking for strstr... yes
  227. checking for strdup... yes
  228. checking whether gcc -std=c99 option works... yes
  229. checking for refresh in -lncurses... yes
  230. checking for curses.h... (cached) yes
  231. configure: creating ./config.status
  232. config.status: creating Makefile
  233. config.status: creating htop.1
  234. config.status: creating config.h
  235. config.status: executing depfiles commands
  236. config.status: executing libtool commands
  237. # 直接进行安装操作
  238. root@DZ:/home/mj/htop_arm/htop-1.0.2# make && make install
  239. make all-am
  240. make[1]: Entering directory '/home/mj/htop_arm/htop-1.0.2'
  241. arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -DNDEBUG -I/home/mj/install_ncurses/include -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/mj/install_htop/etc\" -g -O2 -MT htop-AvailableMetersPanel.o -MD -MP -MF .deps/htop-AvailableMetersPanel.Tpo -c -o htop-AvailableMetersPanel.o `test -f 'AvailableMetersPanel.c' || echo './'`AvailableMetersPanel.c
  242. mv -f .deps/htop-AvailableMetersPanel.Tpo .deps/htop-AvailableMetersPanel.Po
  243. arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -DNDEBUG -I/home/mj/install_ncurses/include -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/mj/install_htop/etc\" -g -O2 -MT htop-CategoriesPanel.o -MD -MP -MF .deps/htop-CategoriesPanel.Tpo -c -o htop-CategoriesPanel.o `test -f 'CategoriesPanel.c' || echo './'`CategoriesPanel.c
  244. mv -f .deps/htop-CategoriesPanel.Tpo .deps/htop-CategoriesPanel.Po
  245. arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -DNDEBUG -I/home/mj/install_ncurses/include -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/mj/install_htop/etc\" -g -O2 -MT htop-CheckItem.o -MD -MP -MF .deps/htop-CheckItem.Tpo -c -o htop-CheckItem.o `test -f 'CheckItem.c' || echo './'`CheckItem.c
  246. mv -f .deps/htop-CheckItem.Tpo .deps/htop-CheckItem.Po
  247. arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -DNDEBUG -I/home/mj/install_ncurses/include -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/mj/install_htop/etc\" -g -O2 -MT htop-ClockMeter.o -MD -MP -MF .deps/htop-ClockMeter.Tpo -c -o htop-ClockMeter.o `test -f 'ClockMeter.c' || echo './'`ClockMeter.c
  248. mv -f .deps/htop-ClockMeter.Tpo .deps/htop-ClockMeter.Po
  249. arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -DNDEBUG -I/home/mj/install_ncurses/include -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/mj/install_htop/etc\" -g -O2 -MT htop-ColorsPanel.o -MD -MP -MF .deps/htop-ColorsPanel.Tpo -c -o htop-ColorsPanel.o `test -f 'ColorsPanel.c' || echo './'`ColorsPanel.c
  250. mv -f .deps/htop-ColorsPanel.Tpo .deps/htop-ColorsPanel.Po
  251. arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -DNDEBUG -I/home/mj/install_ncurses/include -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/mj/install_htop/etc\" -g -O2 -MT htop-ColumnsPanel.o -MD -MP -MF .deps/htop-ColumnsPanel.Tpo -c -o htop-ColumnsPanel.o `test -f 'ColumnsPanel.c' || echo './'`ColumnsPanel.c
  252. mv -f .deps/htop-ColumnsPanel.Tpo .deps/htop-ColumnsPanel.Po
  253. arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -DNDEBUG -I/home/mj/install_ncurses/include -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/mj/install_htop/etc\" -g -O2 -MT htop-CPUMeter.o -MD -MP -MF .deps/htop-CPUMeter.Tpo -c -o htop-CPUMeter.o `test -f 'CPUMeter.c' || echo './'`CPUMeter.c
  254. mv -f .deps/htop-CPUMeter.Tpo .deps/htop-CPUMeter.Po
  255. arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -DNDEBUG -I/home/mj/install_ncurses/include -pedantic -Wall -Wextra -std=c99 -rdynamic -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"/home/mj/install_htop/etc\" -g -O2 -MT htop-CRT.o -MD -MP -MF .deps/htop-CRT.Tpo -c -o htop-CRT.o `test -f 'CRT.c' || echo './'`CRT.c
  256. ....
  257. ....
  258. ....
  259. make install-am
  260. make[1]: Entering directory '/home/mj/htop_arm/htop-1.0.2'
  261. make[2]: Entering directory '/home/mj/htop_arm/htop-1.0.2'
  262. test -z "/home/mj/install_htop/bin" || /bin/mkdir -p "/home/mj/install_htop/bin"
  263. /bin/bash ./libtool --mode=install /usr/bin/install -c htop '/home/mj/install_htop/bin'
  264. libtool: install: /usr/bin/install -c htop /home/mj/install_htop/bin/htop
  265. test -z "/home/mj/install_htop/share/applications" || /bin/mkdir -p "/home/mj/install_htop/share/applications"
  266. /usr/bin/install -c -m 644 htop.desktop '/home/mj/install_htop/share/applications'
  267. test -z "/home/mj/install_htop/share/man/man1" || /bin/mkdir -p "/home/mj/install_htop/share/man/man1"
  268. /usr/bin/install -c -m 644 htop.1 '/home/mj/install_htop/share/man/man1'
  269. test -z "/home/mj/install_htop/share/pixmaps" || /bin/mkdir -p "/home/mj/install_htop/share/pixmaps"
  270. /usr/bin/install -c -m 644 htop.png '/home/mj/install_htop/share/pixmaps'
  271. make[2]: Leaving directory '/home/mj/htop_arm/htop-1.0.2'
  272. make[1]: Leaving directory '/home/mj/htop_arm/htop-1.0.2'
  273. root@DZ:/home/mj/htop_arm/htop-1.0.2# file htop
  274. htop: 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
  275.  

开发板验证

  1. ncurses编译生成的lib文件及htop的可执行文件移植到目标系统对应的文件夹,操作如下:
  2. root@DZ:/home/mj/install_htop/bin# scp htop root@master:/tmp
  3. root@master's password:
  4. htop 100% 511KB 511.3KB/s 00:00
  5. root@DZ:/home/mj/install_ncurses# cd lib/
  6. root@DZ:/home/mj/install_ncurses/lib# scp -r ./* root@master:/tmp
  7. # Cortex-A8平台端
  8. [root@3352-T tmp]# ls
  9. dbus/ libform.a libform_g.a libmenu.so.5.9* libncurses.so.5* libpanel.so* resolv.conf
  10. htop* libform.so* libmenu.a libmenu_g.a libncurses.so.5.9* libpanel.so.5* terminfo/
  11. libcurses.a libform.so.5* libmenu.so* libncurses.a libncurses_g.a libpanel.so.5.9* umconfig.txt
  12. libcurses.so* libform.so.5.9* libmenu.so.5* libncurses.so* libpanel.a libpanel_g.a
  13. 运行效果见下图:

结束语

  1. 以上内容有笔者自己编写,也有摘自互联网。摘自互联网部分笔者都会仔细阅读,确保符合笔者当时测试情况进行编写,当然在学习的过程中不可避免的有理解不到位的地方,还请读友批评指正。

打赏

                    支付宝                                                         微信

微信与支付宝支付

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注