在使用Fedora 7交叉编译μclinux时,当使用make
menuconfig 进行配置时会出现缺少curses.h的错误。错误如下:
make[1]: Entering directory
`/root/uClinux-dist/config/kconfig'
cc
-DCURSES_LOC="" -c -o mconf.o mconf.c
In file included from mconf.c:27:
lxdialog/dialog.h:32:20: error: curses.h: No such file or
directory
In file included from mconf.c:27:
lxdialog/dialog.h:97: error: expected specifier-qualifier-list
before ‘chtype’
lxdialog/dialog.h:187: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:193: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:195: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:196: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:197: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:198: error: expected ‘)’ before ‘*’ token
lxdialog/dialog.h:200: error: expected ‘)’ before ‘*’ token
mconf.c: In function ‘conf’:
mconf.c:610: error: ‘KEY_MAX’ undeclared (first use in this
function)
mconf.c:610: error: (Each undeclared identifier is reported only
once
mconf.c:610: error: for each function it appears in.)
mconf.c: In function ‘conf_choice’:
mconf.c:761: error: ‘KEY_MAX’ undeclared (first use in this
function)
make[1]: *** [mconf.o] Error 1
make[1]: Leaving directory
`/root/uClinux-dist/config/kconfig'
make: *** [/root/uClinux-dist/config/kconfig/mconf] Error 2
出现该错误的原因是在使用menuconfig时,需要ncurses库的支持,该库包含ncurses和ncurses-devel两个包,大部分情况ncurses包会跟随系统安装好,而ncurses-devel包根据安装系统时你的选择。可以使用如下命令查看他们有没有安装:
rpm -q
ncurses
rpm -q
ncurses-devel
如果安装好了,回显示:
ncurses-5.6-9.20070812.fc7
ncurses-devel-5.6-9.20070812.fc7
若没有安装,则使用yum命令进行安装(要求联网):
yum
install ncurses
yum
install ncurses-devel
安装完成,问题解决。
若是在Ubuntu系统下,类似问题可以使用如下命令解决:
sudo apt-get install libncurses5-dev
libncursesw5-dev