【记录】继续去研究在Cygwin下make编译crosstool-ng时LDFLAGS,-lintl,-lcurses,-lncurses与错误_libintl_gettext,_free_item

[【背景】

之前折腾过了:

【已解决】Cygwin下make编译crosstool-ng出错:nconf.o:nconf.c:(.text+0×373): undefined reference to `_free_item’

虽然问题已解决,且已经把相关内容整理到了:

zconf.tab.o:zconf.tab.c:(.text+0x162a): undefined reference to ‘_libintl_gettext’

中,但是,其根本原因,还是未知。

此处,想要继续去研究一下。

目前能想到的是:

针对:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lintl -lcurses"

再去再去研究一下:

(1)是否是由于:

make LDFLAGS="-lintl -lcurses"

和:

$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
nconf: LDFLAGS += -lmenu -lpanel -lncurses

冲突,是由于:

make的LDFLAGS中加的是curses,而makefile中加的是ncurses

而使得,同时使用curses和ncurses,就会出现类似的问题?

(2)或者是:

make不加参数的情况下,即直接:

make

然后makefile中,从:

$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
nconf: LDFLAGS += -lmenu -lpanel -lncurses

改为:

$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses $(INTL_CFLAGS)
nconf: LDFLAGS += -lmenu -lpanel -lncurses

就会出现同样问题???

(3)又或是,我之前是把:

make LDFLAGS="-lintl -lncurses"

错写成了:

make LDFLAGS="-lintl -lcurses"

即,本来该是ncurses错写成了curses,而导致了此处的错误?

 

【折腾过程】

1.目测,感觉第二种更可疑。

所以先去看看效果。

先去make clean了一下:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0_build
$ ct-ng clean
  CLEAN config
  CLEAN config.gen
  CLEAN log

汗,搞错了,应该是去crosstool-ng 的源码的文件夹中去make clean:

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

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ ls
bootstrap  config.log     configure     contrib  ct-ng       ct-ng.in  kconfig   licenses.d  Makefile.in  paths.mk  README   scripts   TODO
config     config.status  configure.ac  COPYING  ct-ng.comp  docs      LICENSES  Makefile    patches      paths.sh  samples  steps.mk

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ ls -lha
总用量 354K
drwxr-xr-x+ 1 Administrator None    0 八月 24 22:18 .
drwxr-xr-x+ 1 Administrator None    0 八月 25 19:55 ..
-rw-r--r--  1 Administrator None    7 二月  1 2013 .version
-rwxr-xr-x  1 Administrator None  124 二月  1 2013 bootstrap
drwxr-xr-x+ 1 Administrator None    0 八月 24 22:18 config
-rw-r--r--  1 Administrator None  21K 八月 24 16:57 config.log
-rwxr-xr-x  1 Administrator None  26K 八月 24 16:57 config.status
-rwxr-xr-x  1 Administrator None 199K 二月  1 2013 configure
-rw-r--r--  1 Administrator None  14K 二月  1 2013 configure.ac
drwxr-xr-x+ 1 Administrator None    0 二月  1 2013 contrib
-rw-r--r--  1 Administrator None 2.5K 二月  1 2013 COPYING
-rwxr-xr-x  1 Administrator None 4.9K 八月 24 22:18 ct-ng
-rw-r--r--  1 Administrator None 1.4K 二月  1 2013 ct-ng.comp
-rw-r--r--  1 Administrator None 4.8K 二月  1 2013 ct-ng.in
drwxr-xr-x+ 1 Administrator None    0 八月 24 22:35 docs
drwxr-xr-x+ 1 Administrator None    0 八月 24 22:35 kconfig
lrwxrwxrwx  1 Administrator None    7 二月  1 2013 LICENSES -> COPYING
drwxr-xr-x+ 1 Administrator None    0 二月  1 2013 licenses.d
-rw-r--r--  1 Administrator None  14K 八月 24 16:57 Makefile
-rw-r--r--  1 Administrator None  14K 二月  1 2013 Makefile.in
drwxr-xr-x+ 1 Administrator None    0 二月  1 2013 patches
-rw-r--r--  1 Administrator None  355 八月 24 22:43 paths.mk
-rw-r--r--  1 Administrator None  379 八月 24 22:43 paths.sh
-rw-r--r--  1 Administrator None  710 二月  1 2013 README
drwxr-xr-x+ 1 Administrator None    0 二月  1 2013 samples
drwxr-xr-x+ 1 Administrator None    0 八月 24 22:18 scripts
-rw-r--r--  1 Administrator None 2.3K 二月  1 2013 steps.mk
-rw-r--r--  1 Administrator None  811 二月  1 2013 TODO

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make clean
  RM     'ct-ng'
  RM     'scripts/crosstool-NG.sh'
  RM     'scripts/saveSample.sh'
  RM     'scripts/showTuple.sh'
  RM     'paths'
  RM     'config/configure.in'
  RM     'kconfig'
  RM     'docs/ct-ng.1'
  RM     'docs/ct-ng.1.gz'

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

然后去修改:

E:\dev_install_root\cygwin\home\develop\crosstool-ng\crosstool-ng-1.18.0\kconfig\Makefile

改为:

#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses $(INTL_CFLAGS)
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses/ $(INTL_CFLAGS)
$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses/
nconf: LDFLAGS += -lintl -lmenu -lpanel -lncurses

然后再去make试试,结果是可以的:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  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'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
  SED    'docs/ct-ng.1'
  GZIP   'docs/ct-ng.1.gz'

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

所以说明:

此处,不是由于

CFLAGS +=

的时候,路径:

$(INTL_CFLAGS)

-I/usr/include/ncurses/

颠倒就会出错,此处的两者的顺序是无关的。

2.那再去试试,再改:

E:\dev_install_root\cygwin\home\develop\crosstool-ng\crosstool-ng-1.18.0\kconfig\Makefile

回原来的:

#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses $(INTL_CFLAGS)
$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses/ $(INTL_CFLAGS)
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses/
nconf: LDFLAGS += -lintl -lmenu -lpanel -lncurses

但是make时LDFLAGS中添加lcurses(而估计不是lncurses)。

结果,会出现找不到“_libintl_gettext”的情况:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make clean
  RM     'ct-ng'
  RM     'scripts/crosstool-NG.sh'
  RM     'scripts/saveSample.sh'
  RM     'scripts/showTuple.sh'
  RM     'paths'
  RM     'config/configure.in'
  RM     'kconfig'
  RM     'docs/ct-ng.1'
  RM     'docs/ct-ng.1.gz'

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lcurses"
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  LD     'conf'
zconf.tab.o:zconf.tab.c:(.text+0x162a): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x47fe): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x56ec): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x58be): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0xc70b): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0xc719): more undefined references to `_libintl_gettext' follow
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: zconf.tab.o: bad reloc address 0x110 in section `.data'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld 返回 1
Makefile:113: recipe for target `conf' failed
make[2]: *** [conf] 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
$

3.再去加上-lintl试试:

结果就会出现那个“_free_item”的(诡异)问题:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make clean
  RM     'ct-ng'
  RM     'scripts/crosstool-NG.sh'
  RM     'scripts/saveSample.sh'
  RM     'scripts/showTuple.sh'
  RM     'paths'
  RM     'config/configure.in'
  RM     'kconfig'
  RM     'docs/ct-ng.1'
  RM     'docs/ct-ng.1.gz'

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lintl -lcurses"
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  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'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x3cc): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x3d4): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x5cc): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x5fc): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x6e0): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x709): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x738): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x750): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x76b): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x78d): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x795): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x7aa): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x7c5): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x12be): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x12e1): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x12ee): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x1342): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x135c): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x137b): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x1396): undefined reference to `_set_current_item'
nconf.o:nconf.c:(.text+0x13ab): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x14ff): undefined reference to `_set_menu_items'
nconf.o:nconf.c:(.text+0x151a): undefined reference to `_scale_menu'
nconf.o:nconf.c:(.text+0x15ac): undefined reference to `_set_menu_win'
nconf.o:nconf.c:(.text+0x15c0): undefined reference to `_set_menu_sub'
nconf.o:nconf.c:(.text+0x15dc): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x160a): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x161c): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x19b3): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1a22): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1b08): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b22): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b39): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b50): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b67): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b7e): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x1c32): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x21f9): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x22c1): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x23a7): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23c1): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23d8): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23ef): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x2406): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x241d): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x28fb): undefined reference to `_new_panel'
nconf.o:nconf.c:(.text+0x2a2a): undefined reference to `_new_menu'
nconf.o:nconf.c:(.text+0x2a44): undefined reference to `_menu_opts_off'
nconf.o:nconf.c:(.text+0x2a59): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a6e): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a83): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a98): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2aad): undefined reference to `_set_menu_mark'
nconf.o:nconf.c:(.text+0x2ac4): undefined reference to `_set_menu_fore'
nconf.o:nconf.c:(.text+0x2adb): undefined reference to `_set_menu_back'
nconf.o:nconf.c:(.text+0x2af2): undefined reference to `_set_menu_grey'
nconf.o:nconf.c:(.text+0x2b89): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x2b96): undefined reference to `_free_menu'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: nconf.o: bad reloc address 0x0 in section `.data'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld 返回 1
Makefile:109: recipe for target `nconf' failed
make[2]: *** [nconf] 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
$

4.那试试,把LDFLAGS中的-lintl和-lcurses的顺序换换,试试是否有变化:

结果和上面一样,问题依旧是那个“_free_item”:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make clean
  RM     'ct-ng'
  RM     'scripts/crosstool-NG.sh'
  RM     'scripts/saveSample.sh'
  RM     'scripts/showTuple.sh'
  RM     'paths'
  RM     'config/configure.in'
  RM     'kconfig'
  RM     'docs/ct-ng.1'
  RM     'docs/ct-ng.1.gz'

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lcurses -lintl"
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  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'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x3cc): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x3d4): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x5cc): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x5fc): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x6e0): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x709): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x738): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x750): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x76b): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x78d): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x795): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x7aa): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x7c5): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x12be): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x12e1): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x12ee): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x1342): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x135c): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x137b): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x1396): undefined reference to `_set_current_item'
nconf.o:nconf.c:(.text+0x13ab): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x14ff): undefined reference to `_set_menu_items'
nconf.o:nconf.c:(.text+0x151a): undefined reference to `_scale_menu'
nconf.o:nconf.c:(.text+0x15ac): undefined reference to `_set_menu_win'
nconf.o:nconf.c:(.text+0x15c0): undefined reference to `_set_menu_sub'
nconf.o:nconf.c:(.text+0x15dc): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x160a): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x161c): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x19b3): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1a22): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1b08): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b22): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b39): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b50): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b67): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b7e): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x1c32): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x21f9): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x22c1): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x23a7): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23c1): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23d8): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23ef): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x2406): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x241d): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x28fb): undefined reference to `_new_panel'
nconf.o:nconf.c:(.text+0x2a2a): undefined reference to `_new_menu'
nconf.o:nconf.c:(.text+0x2a44): undefined reference to `_menu_opts_off'
nconf.o:nconf.c:(.text+0x2a59): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a6e): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a83): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a98): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2aad): undefined reference to `_set_menu_mark'
nconf.o:nconf.c:(.text+0x2ac4): undefined reference to `_set_menu_fore'
nconf.o:nconf.c:(.text+0x2adb): undefined reference to `_set_menu_back'
nconf.o:nconf.c:(.text+0x2af2): undefined reference to `_set_menu_grey'
nconf.o:nconf.c:(.text+0x2b89): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x2b96): undefined reference to `_free_menu'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: nconf.o: bad reloc address 0x0 in section `.data'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld 返回 1
Makefile:109: recipe for target `nconf' failed
make[2]: *** [nconf] 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
$

5.然后把LDFLAGS中的curses换成ncurses试试:

结果也是问题依旧,是那个“_free_item”的错误:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make clean
  RM     'ct-ng'
  RM     'scripts/crosstool-NG.sh'
  RM     'scripts/saveSample.sh'
  RM     'scripts/showTuple.sh'
  RM     'paths'
  RM     'config/configure.in'
  RM     'kconfig'
  RM     'docs/ct-ng.1'
  RM     'docs/ct-ng.1.gz'

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lintl -lncurses"
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  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'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x3cc): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x3d4): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x5cc): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x5fc): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x6e0): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x709): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x738): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x750): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x76b): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x78d): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x795): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x7aa): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x7c5): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x12be): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x12e1): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x12ee): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x1342): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x135c): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x137b): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x1396): undefined reference to `_set_current_item'
nconf.o:nconf.c:(.text+0x13ab): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x14ff): undefined reference to `_set_menu_items'
nconf.o:nconf.c:(.text+0x151a): undefined reference to `_scale_menu'
nconf.o:nconf.c:(.text+0x15ac): undefined reference to `_set_menu_win'
nconf.o:nconf.c:(.text+0x15c0): undefined reference to `_set_menu_sub'
nconf.o:nconf.c:(.text+0x15dc): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x160a): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x161c): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x19b3): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1a22): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1b08): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b22): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b39): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b50): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b67): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b7e): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x1c32): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x21f9): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x22c1): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x23a7): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23c1): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23d8): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23ef): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x2406): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x241d): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x28fb): undefined reference to `_new_panel'
nconf.o:nconf.c:(.text+0x2a2a): undefined reference to `_new_menu'
nconf.o:nconf.c:(.text+0x2a44): undefined reference to `_menu_opts_off'
nconf.o:nconf.c:(.text+0x2a59): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a6e): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a83): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a98): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2aad): undefined reference to `_set_menu_mark'
nconf.o:nconf.c:(.text+0x2ac4): undefined reference to `_set_menu_fore'
nconf.o:nconf.c:(.text+0x2adb): undefined reference to `_set_menu_back'
nconf.o:nconf.c:(.text+0x2af2): undefined reference to `_set_menu_grey'
nconf.o:nconf.c:(.text+0x2b89): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x2b96): undefined reference to `_free_menu'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: nconf.o: bad reloc address 0x0 in section `.data'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld 返回 1
Makefile:109: recipe for target `nconf' failed
make[2]: *** [nconf] 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
$

6.看来,的确是LDFLAGS添加了-lintl后,就导致了此问题的出现。

那看起来应该是:

makefile中,都已经是:

# lxdialog source files
LX_SRC = $(wildcard lxdialog/*.c)
LX_OBJ = $(patsubst %.c,%.o,$(LX_SRC))
LX_DEP = $(patsubst %.o,%.dep,$(LX_OBJ))
$(LX_OBJ) $(LX_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)

# What's needed to build 'conf'
conf_SRC = conf.c
conf_OBJ = $(patsubst %.c,%.o,$(conf_SRC))
conf_DEP = $(patsubst %.o,%.dep,$(conf_OBJ))
$(conf_OBJ) $(conf_DEP): CFLAGS += $(INTL_CFLAGS)
conf: LDFLAGS += -lintl

# What's needed to build 'mconf'
mconf_SRC = mconf.c
mconf_OBJ = $(patsubst %.c,%.o,$(mconf_SRC))
mconf_DEP = $(patsubst %.c,%.dep,$(mconf_SRC))
$(mconf_OBJ) $(mconf_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
#mconf: LDFLAGS += $(NCURSES_LDFLAGS)
mconf: LDFLAGS += -lintl $(NCURSES_LDFLAGS)

# What's needed to build 'nconf'
nconf_SRC = nconf.c nconf.gui.c
nconf_OBJ = $(patsubst %.c,%.o,$(nconf_SRC))
nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses $(INTL_CFLAGS)
$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses/ $(INTL_CFLAGS)
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses/
nconf: LDFLAGS += -lintl -lmenu -lpanel -lncurses

感觉LDFLAGS都已经nconf的前面,在conf,mconf时,都已经添加过了对应的-lintl,也算-lintl加了2此了

加上nconf这次,LDFLAGS中,都加了3次的-lintl了,

此处,即使是从make传入的LDFLAGS中,再添加一次,也还是,无谓的,加了4次的-lintl而已,

即,在3次的-lintl基础上再加一次,应该不影响才对。

7.不过,才发现,此处是:

针对于conf,mconf,nconf,其实都只是依赖于自己当前的LDFLAGS,即:

conf,mconf,nconf对应的LDFLAGS,都是独立的,

所以,前面的-lintl,都只是加了一次而已。

8.但是,为何其他两个,即conf和mconf,也都在LDFLAGS中,加了对应的-lintl了,都可以正常编译,

唯独此处的nconf,从make中得到传入的LDFLAGS中,含有-lintl,然后加上自己当前的:

-lintl -lmenu -lpanel –lncurses

就出错了呢?

9.看到:

nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x3cc): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x3d4): undefined reference to `_item_index'

突然想起来了,可以去看看对应的nconf.c中的源码:

E:\dev_install_root\cygwin\home\develop\crosstool-ng\crosstool-ng-1.18.0\kconfig\nconf.c

看看是否调用到了这些函数。

结果是:

(1)_free_item

没找到。

但是找到了free_item:

static void clean_items(void)
{
	int i;
	for (i = 0; curses_menu_items[i]; i++)
		free_item(curses_menu_items[i]);
	bzero(curses_menu_items, sizeof(curses_menu_items));
	bzero(k_menu_items, sizeof(k_menu_items));
	items_num = 0;
}

/* very hackish. adds a string to the last item added */
static void item_add_str(const char *fmt, ...)
{
	va_list ap;
	int index = items_num-1;
......
	free_item(curses_menu_items[index]);
	curses_menu_items[index] = new_item(
			k_menu_items[index].str,
			k_menu_items[index].str);
	set_item_userptr(curses_menu_items[index],
			&k_menu_items[index]);
}

(2)_current_item

没找到。

但是找到了一堆对于:current_item,的调用。

(3)然后对于其他的,也是类似的,

比如:

_set_item_userptr

找不到,但是可以找到:

set_item_userptr

10.再去试试,把makefile中include路径再变化一下,改为:

#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses $(INTL_CFLAGS)
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses/ $(INTL_CFLAGS)
$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses/
nconf: LDFLAGS += -lintl -lmenu -lpanel -lncurses

然后再去用make的LDFLAGS中包含-lintl -lncurses去试试结果:

结果错误依旧:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make clean
  RM     'ct-ng'
  RM     'scripts/crosstool-NG.sh'
  RM     'scripts/saveSample.sh'
  RM     'scripts/showTuple.sh'
  RM     'paths'
  RM     'config/configure.in'
  RM     'kconfig'
  RM     'docs/ct-ng.1'
  RM     'docs/ct-ng.1.gz'

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lintl -lncurses"
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  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'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x3cc): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x3d4): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x5cc): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x5fc): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x6e0): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x709): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x738): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x750): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x76b): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x78d): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x795): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x7aa): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x7c5): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x12be): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x12e1): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x12ee): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x1342): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x135c): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x137b): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x1396): undefined reference to `_set_current_item'
nconf.o:nconf.c:(.text+0x13ab): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x14ff): undefined reference to `_set_menu_items'
nconf.o:nconf.c:(.text+0x151a): undefined reference to `_scale_menu'
nconf.o:nconf.c:(.text+0x15ac): undefined reference to `_set_menu_win'
nconf.o:nconf.c:(.text+0x15c0): undefined reference to `_set_menu_sub'
nconf.o:nconf.c:(.text+0x15dc): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x160a): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x161c): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x19b3): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1a22): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1b08): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b22): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b39): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b50): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b67): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b7e): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x1c32): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x21f9): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x22c1): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x23a7): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23c1): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23d8): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23ef): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x2406): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x241d): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x28fb): undefined reference to `_new_panel'
nconf.o:nconf.c:(.text+0x2a2a): undefined reference to `_new_menu'
nconf.o:nconf.c:(.text+0x2a44): undefined reference to `_menu_opts_off'
nconf.o:nconf.c:(.text+0x2a59): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a6e): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a83): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a98): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2aad): undefined reference to `_set_menu_mark'
nconf.o:nconf.c:(.text+0x2ac4): undefined reference to `_set_menu_fore'
nconf.o:nconf.c:(.text+0x2adb): undefined reference to `_set_menu_back'
nconf.o:nconf.c:(.text+0x2af2): undefined reference to `_set_menu_grey'
nconf.o:nconf.c:(.text+0x2b89): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x2b96): undefined reference to `_free_menu'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: nconf.o: bad reloc address 0x0 in section `.data'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld 返回 1
Makefile:109: recipe for target `nconf' failed
make[2]: *** [nconf] 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
$

只能说明:

make的LDFLAGS包含了-lintl,

此处makefile中LDFLAGS也包含了-lintl的话,

就比如出现上面这个”_free_item”的错误。

但是原因还是没搞懂。

11.再去试试,make传递进入的LDFLAGS中,只有-lncurses,没有-lintl试试:

结果是:

会出现那个“_libintl_gettext”的问题:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make clean
  RM     'ct-ng'
  RM     'scripts/crosstool-NG.sh'
  RM     'scripts/saveSample.sh'
  RM     'scripts/showTuple.sh'
  RM     'paths'
  RM     'config/configure.in'
  RM     'kconfig'
  RM     'docs/ct-ng.1'
  RM     'docs/ct-ng.1.gz'

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lncurses"
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  LD     'conf'
zconf.tab.o:zconf.tab.c:(.text+0x162a): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x47fe): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x56ec): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x58be): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0xc70b): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0xc719): more undefined references to `_libintl_gettext' follow
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: zconf.tab.o: bad reloc address 0x110 in section `.data'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld 返回 1
Makefile:113: recipe for target `conf' failed
make[2]: *** [conf] 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
$

所以,也很是奇怪。

12.再去把make的LDFLAGS中的-lncurses改为-lcurses:

结果问题如上,同样是”_libintl_gettext”的错误:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lcurses"
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  LD     'conf'
zconf.tab.o:zconf.tab.c:(.text+0x162a): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x47fe): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x56ec): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0x58be): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0xc70b): undefined reference to `_libintl_gettext'
zconf.tab.o:zconf.tab.c:(.text+0xc719): more undefined references to `_libintl_gettext' follow
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: zconf.tab.o: bad reloc address 0x110 in section `.data'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld 返回 1
Makefile:113: recipe for target `conf' failed
make[2]: *** [conf] 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
$

13.再去把makefile中,-lintl和-lncurses都去掉,变成:

#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses $(INTL_CFLAGS)
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses/ $(INTL_CFLAGS)
$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses/
#nconf: LDFLAGS += -lintl -lmenu -lpanel -lncurses
nconf: LDFLAGS += -lmenu -lpanel

然后make时LDFLAGS中,再传入对应的-lintl和-lncurses,试试效果:

结果出现之前的那个”_free_item”的错误:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lintl -lncurses"
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  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'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x3cc): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x3d4): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x5cc): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x5fc): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x6e0): undefined reference to `_free_item'
nconf.o:nconf.c:(.text+0x709): undefined reference to `_new_item'
nconf.o:nconf.c:(.text+0x738): undefined reference to `_set_item_userptr'
nconf.o:nconf.c:(.text+0x750): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x76b): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x78d): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x795): undefined reference to `_item_index'
nconf.o:nconf.c:(.text+0x7aa): undefined reference to `_current_item'
nconf.o:nconf.c:(.text+0x7c5): undefined reference to `_item_userptr'
nconf.o:nconf.c:(.text+0x12be): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x12e1): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x12ee): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x1342): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x135c): undefined reference to `_item_count'
nconf.o:nconf.c:(.text+0x137b): undefined reference to `_set_top_row'
nconf.o:nconf.c:(.text+0x1396): undefined reference to `_set_current_item'
nconf.o:nconf.c:(.text+0x13ab): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x14ff): undefined reference to `_set_menu_items'
nconf.o:nconf.c:(.text+0x151a): undefined reference to `_scale_menu'
nconf.o:nconf.c:(.text+0x15ac): undefined reference to `_set_menu_win'
nconf.o:nconf.c:(.text+0x15c0): undefined reference to `_set_menu_sub'
nconf.o:nconf.c:(.text+0x15dc): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x160a): undefined reference to `_set_menu_format'
nconf.o:nconf.c:(.text+0x161c): undefined reference to `_post_menu'
nconf.o:nconf.c:(.text+0x19b3): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1a22): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x1b08): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b22): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b39): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b50): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b67): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x1b7e): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x1c32): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x21f9): undefined reference to `_top_row'
nconf.o:nconf.c:(.text+0x22c1): undefined reference to `_menu_win'
nconf.o:nconf.c:(.text+0x23a7): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23c1): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23d8): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x23ef): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x2406): undefined reference to `_menu_driver'
nconf.o:nconf.c:(.text+0x241d): more undefined references to `_menu_driver' follow
nconf.o:nconf.c:(.text+0x28fb): undefined reference to `_new_panel'
nconf.o:nconf.c:(.text+0x2a2a): undefined reference to `_new_menu'
nconf.o:nconf.c:(.text+0x2a44): undefined reference to `_menu_opts_off'
nconf.o:nconf.c:(.text+0x2a59): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a6e): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a83): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2a98): undefined reference to `_menu_opts_on'
nconf.o:nconf.c:(.text+0x2aad): undefined reference to `_set_menu_mark'
nconf.o:nconf.c:(.text+0x2ac4): undefined reference to `_set_menu_fore'
nconf.o:nconf.c:(.text+0x2adb): undefined reference to `_set_menu_back'
nconf.o:nconf.c:(.text+0x2af2): undefined reference to `_set_menu_grey'
nconf.o:nconf.c:(.text+0x2b89): undefined reference to `_unpost_menu'
nconf.o:nconf.c:(.text+0x2b96): undefined reference to `_free_menu'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: nconf.o: bad reloc address 0x0 in section `.data'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: ld 返回 1
Makefile:110: recipe for target `nconf' failed
make[2]: *** [nconf] 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
$

14.截止目前,真的是没有完全搞懂,为何会出现这种,

至少看起来,很奇怪的现象。

还是把makefile文件:

E:\dev_install_root\cygwin\home\develop\crosstool-ng\crosstool-ng-1.18.0\kconfig\Makefile

改为原先的:

#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses $(INTL_CFLAGS)
$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses/ $(INTL_CFLAGS)
#$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses/
nconf: LDFLAGS += -lintl -lmenu -lpanel -lncurses
#nconf: LDFLAGS += -lmenu -lpanel

然后make中不指定参数的去编译:

最终就是可以的了:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make
  SED    'ct-ng'
  SED    'scripts/crosstool-NG.sh'
  SED    'scripts/saveSample.sh'
  SED    'scripts/showTuple.sh'
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.gui.dep'
  DEP    'nconf.dep'
  DEP    'lxdialog/checklist.dep'
  DEP    'lxdialog/inputbox.dep'
  DEP    'lxdialog/util.dep'
  DEP    'lxdialog/textbox.dep'
  DEP    'lxdialog/yesno.dep'
  DEP    'lxdialog/menubox.dep'
  DEP    'mconf.dep'
  DEP    'conf.dep'
  BISON  'zconf.tab.c'
  GPERF  'zconf.hash.c'
  LEX    'lex.zconf.c'
  DEP    'zconf.tab.dep'
  CC     'zconf.tab.o'
  CC     'conf.o'
  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'
  CC     'nconf.o'
  CC     'nconf.gui.o'
  LD     'nconf'
  SED    'docs/ct-ng.1'
  GZIP   'docs/ct-ng.1.gz'

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

 

【总结】

截止目前,已知的是:

(1)关于出现”_free_item”的错误:

当makefile中(nconf的)LDFLAGS包含了-lintl,

然后make时传入的LDFLAGS也包含了-lintl的话,

就一定会出现这个”_free_item”的错误。

(2)关于出现“_libintl_gettext”的问题:

make传递进入的LDFLAGS中,只有-lncurses,没有-lintl试试:

则又会出现那个“_libintl_gettext”的问题

(3)正常编译

目前只能通过:

对于nconf来说:

makefile中,正常是:

$(nconf_OBJ) $(nconf_DEP): CFLAGS += -I/usr/include/ncurses/ $(INTL_CFLAGS)
nconf: LDFLAGS += -lintl -lmenu -lpanel -lncurses

然后编译的时候,make不指定任何参数:

make

去编译,就是正常的。

 

具体上述现象的根本原因,至今未搞明白。



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量