最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

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

crosstool-ng crifan 3528浏览 0评论

【问题】

折腾:

【记录】Cygwin下配置编译和安装crosstool-ng

期间,在cygwin下,make编译crosstool-ng时出错:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make LDFLAGS="-lintl -lcurses"
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  DEP    'nconf.dep'
  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 returned 1 exit status
Makefile:104: 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

如图:

nconf o nconf c text 0x373 undefined reference to _free_item

即:

nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item’

【解决过程】

1.看起来又是缺少了某个库。

但是结果google搜:

mconf.o undefined reference to _free_item

之类的,都找不到有类似的错误。

2.搜

_free_item _current_item _item_index

找到一个:

http://vak-opensource.googlecode.com/svn/trunk/hash-bench/symbols

但是还是没搞懂,到底是属于哪个库的。

3.后来找到:

http://vak-opensource.googlecode.com/svn/trunk/hash-bench/

中有个

http://vak-opensource.googlecode.com/svn/trunk/hash-bench/Makefile

其中提到了

hash-bench

所以去看看是个什么东西。

但是没找到。

4.重新make clean一下:

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'

再重新make试试:

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 returned 1 exit status
Makefile:104: 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.后来实在不行了,无意间,参考之前的:

【已解决】cygwin中编译crosstool-ng出错:zconf.tab.o:zconf.tab.c:(.text+0x162a): undefined reference to ‘_libintl_gettext’

去把

crosstool-ng-1.18.0\kconfig\Makefile

中的nconf从:

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

改为:

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

再去编译:

make LDFLAGS="-lintl -lcurses"

结果问题依旧。

6.再改为:

#$(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: LDFLAGS += -lmenu -lpanel -lncurses

再试试:

make LDFLAGS="-lintl -lcurses"

结果问题还是依旧。

7.再改为:

#$(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: LDFLAGS += -lintl -lmenu -lpanel -lncurses

再去用

make LDFLAGS="-lintl -lcurses"

编译试试,结果问题依旧。

8.再改为:

$(conf_OBJ) $(conf_DEP): CFLAGS += $(INTL_CFLAGS)
conf: LDFLAGS += -lintl

#mconf: LDFLAGS += $(NCURSES_LDFLAGS)
mconf: LDFLAGS += -lintl $(NCURSES_LDFLAGS)


#$(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: LDFLAGS += -lintl -lmenu -lpanel -lncurses

再去试试:

make

结果就可以了:

Administrator@PC-20130611GART /home/develop/crosstool-ng/crosstool-ng-1.18.0
$ make
  GEN    'config/configure.in'
  GEN    'paths.mk'
  GEN    'paths.sh'
  LD     'nconf'
  SED    'docs/ct-ng.1'
  GZIP   'docs/ct-ng.1.gz'

如图:

ld nconf done ok

 

【总结】

此处,在cygwin中,make编译crosstool-ng出现:

nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item’

的错误,

原因是:

好像是,之前的make加了参数:

make LDFLAGS="-lintl -lcurses"

和nconf部分:

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

冲突了。

所以导致出现相对比较异常的问题,而且始终都找不到解决办法。

 

解决办法是:

最后是:

确保make时不要通过LDFLAGS去指定那些库intl和curses

只是通过修改makefile文件:

crosstool-ng-1.18.0\kconfig\Makefile

改为:

$(conf_OBJ) $(conf_DEP): CFLAGS += $(INTL_CFLAGS)
conf: LDFLAGS += -lintl

#mconf: LDFLAGS += $(NCURSES_LDFLAGS)
mconf: LDFLAGS += -lintl $(NCURSES_LDFLAGS)

#$(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 += -lintl -lmenu -lpanel -lncurses

然后直接

make

编译就可以了。

转载请注明:在路上 » 【已解决】Cygwin下make编译crosstool-ng出错:nconf.o:nconf.c:(.text+0x373): undefined reference to `_free_item’

与本文相关的文章

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.208 seconds, using 22.35MB memory