5.1.2.2. lxdialog/menubox.o:menubox.c:(.text+0x7d): undefined reference to `_wattrset'

错误现象:

cygwin下make编译crosstool-ng出错:


Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lintl"
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  LD     'conf'
  CC     'lxdialog/menubox.o'
  CC     'lxdialog/yesno.o'
  CC     'lxdialog/textbox.o'
  CC     'lxdialog/util.o'
  CC     'lxdialog/inputbox.o'
  CC     'lxdialog/checklist.o'
  CC     'mconf.o'
  LD     'mconf'
lxdialog/menubox.o:menubox.c:(.text+0x7d): undefined reference to `_wattrset'
lxdialog/menubox.o:menubox.c:(.text+0x97): undefined reference to `_wmove'
......
mconf.o:mconf.c:(.text+0x13de): undefined reference to `_ncwrap_stdscr'
mconf.o:mconf.c:(.text+0x13e6): undefined reference to `_getcurx'
collect2: ld returned 1 exit status
Makefile:100: recipe for target `mconf' failed
make[2]: *** [mconf] Error 1
Makefile:160: recipe for target `build-lib-kconfig' failed
make[1]: *** [build-lib-kconfig] Error 2
Makefile:120: recipe for target `build' failed
make: *** [build] Error 2

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0$

            

原因:

Cygwin下虽然已经安装了ncurses库,但是此处make编译的时候,没有链接进去,所以报错。

解决办法:

参见:第 5.1.2.1 节 “zconf.tab.o:zconf.tab.c:(.text+0x162a): undefined reference to ‘_libintl_gettext'”中的此处也同时添加了ncurses库,解决了undefined reference to `_wattrset'的问题,去修改makefile而解决。

注意:参见之前此处不要通过make时加LDFLAGS参数去添加-lintl和-lcurses的解释,不要通过给make加LDFLAGS的方式去解决此问题,而是如上,使用修改makefile去解决此问题。