xscale linux内核编译,【已解决】Cygwin下用arm-xscale-linux-gnueabi交叉编译Linux内核在配置时出错:scripts/kconfig/conf.o:conf....

【问题】

折腾:

期间,解决了:

后,又出现错误:CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1

$ make whgs_defconfig

HOSTCC scripts/basic/fixdep

scripts/basic/fixdep.c: In function ‘parse_config_file’:

scripts/basic/fixdep.c:242:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/fixdep.c: In function ‘parse_dep_file’:

scripts/basic/fixdep.c:319:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/fixdep.c: In function ‘traps’:

scripts/basic/fixdep.c:371:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

scripts/basic/fixdep.c:373:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

HOSTCC scripts/basic/docproc

scripts/basic/docproc.c: In function ‘find_export_symbols’:

scripts/basic/docproc.c:188:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:191:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:197:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:200:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c: In function ‘singfunc’:

scripts/basic/docproc.c:267:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c: In function ‘parse_file’:

scripts/basic/docproc.c:300:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:305:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:310:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:316:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:319:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

HOSTCC scripts/kconfig/conf.o

scripts/kconfig/conf.c: In function ‘strip’:

scripts/kconfig/conf.c:45:2: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/kconfig/conf.c:53:2: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/kconfig/conf.c: In function ‘conf_string’:

scripts/kconfig/conf.c:174:20: warning: variable ‘help’ set but not used [-Wunused-but-set-variable]

scripts/kconfig/conf.c: In function ‘conf_sym’:

scripts/kconfig/conf.c:208:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]

scripts/kconfig/conf.c: In function ‘conf_choice’:

scripts/kconfig/conf.c:368:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/kconfig/conf.c:283:6: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]

HOSTCC scripts/kconfig/kxgettext.o

HOSTCC scripts/kconfig/zconf.tab.o

In file included from scripts/kconfig/zconf.tab.c:2340:0:

scripts/kconfig/confdata.c: In function ‘conf_expand_value’:

scripts/kconfig/confdata.c:57:3: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/kconfig/confdata.c: In function ‘conf_read_simple’:

scripts/kconfig/confdata.c:238:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/kconfig/confdata.c: In function ‘conf_split_config’:

scripts/kconfig/confdata.c:608:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]

In file included from scripts/kconfig/zconf.tab.c:2343:0:

scripts/kconfig/menu.c: In function ‘menu_add_prop’:

scripts/kconfig/menu.c:131:3: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/kconfig/menu.c:133:4: warning: array subscript has type ‘char’ [-Wchar-subscripts]

In file included from scripts/kconfig/zconf.tab.c:2338:0:

scripts/kconfig/zconf.tab.c: At top level:

scripts/kconfig/lex.zconf.c:1620:16: warning: ‘input’ defined but not used [-Wunused-function]

HOSTLD scripts/kconfig/conf

scripts/kconfig/conf.o:conf.c:(.text+0x1f): undefined reference to `libintl_gettext'

scripts/kconfig/conf.o:conf.c:(.text+0x33): undefined reference to `libintl_gettext'

scripts/kconfig/conf.o:conf.c:(.text+0x47): undefined reference to `libintl_gettext'

scripts/kconfig/conf.o:conf.c:(.text+0xd56): undefined reference to `libintl_gettext'

/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: scripts/kconfig/conf.o: bad reloc address 0x70 in section `.rdata'

/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation

collect2: error: ld returned 1 exit status

make[1]: *** [scripts/kconfig/conf] Error 1

make: *** [whgs_defconfig] Error 2

CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1

$

即:scripts/kconfig/conf.o:conf.c:(.text+0x1f): undefined reference to `libintl_gettext’

如图:

25b9550184e21688b69a282b886d9f72.png

【解决过程】

1.看到:

说是需要重新编译gcc等内容。

如果是的话,那岂不是:

极其耗时,那么也就可以放在cygwin下编译linux内核了。

2.参考:

去尝试打上对应的补丁,看看是否有效:

结果此处的

linux-2.6.19.1\scripts\Makefile.host

和帖子里面的,还不太一样:

帖子里是:# Create executable from a single .c file

# host-csingle -> Executable

quiet_cmd_host-csingle = HOSTCC $@

- cmd_host-csingle= $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $<

+ cmd_host-csingle= $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) \

+ $(HOSTLOADLIBES_$(@F)) -o $@ $<

$(host-csingle): %: %.c FORCE

$(call if_changed_dep,host-csingle)

而自己此处的是:# Create executable from a single .c file

# host-csingle -> Executable

quiet_cmd_host-csingle = HOSTCC $@

cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \

$(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))

$(host-csingle): %: %.c FORCE

$(call if_changed_dep,host-csingle)

看起来,也不太好改。也不会改。也好像不需要改。

所以暂时不改。

3.再去看看:

kernel\linux-2.6.19.1\scripts\kconfig\Makefile

修改后为:# ===========================================================================

# Local mods. This is for cygwin-hosted builds. Should be harmlessly

# superfluous on Linux platforms where libintl functionality is in glibc.

#ifeq (${OSTYPE},cygwin)

HOST_LOADLIBES := -lintl

#endif

# ===========================================================================

# Kernel configuration targets

# These targets are used from top-level makefile

然后再重新配置试试,结果错误依旧:CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1

$ make whgs_defconfig

HOSTCC scripts/basic/docproc

scripts/basic/docproc.c: In function ‘find_export_symbols’:

scripts/basic/docproc.c:188:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:191:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:197:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:200:5: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c: In function ‘singfunc’:

scripts/basic/docproc.c:267:17: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c: In function ‘parse_file’:

scripts/basic/docproc.c:300:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:305:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:310:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:316:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

scripts/basic/docproc.c:319:6: warning: array subscript has type ‘char’ [-Wchar-subscripts]

HOSTLD scripts/kconfig/conf

scripts/kconfig/conf.o:conf.c:(.text+0x1f): undefined reference to `libintl_gettext'

scripts/kconfig/conf.o:conf.c:(.text+0x33): undefined reference to `libintl_gettext'

scripts/kconfig/conf.o:conf.c:(.text+0x47): undefined reference to `libintl_gettext'

scripts/kconfig/conf.o:conf.c:(.text+0xd56): undefined reference to `libintl_gettext'

/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: scripts/kconfig/conf.o: bad reloc address 0x70 in section `.rdata'

/usr/lib/gcc/i686-pc-cygwin/4.7.3/../../../../i686-pc-cygwin/bin/ld: final link failed: Invalid operation

collect2: error: ld returned 1 exit status

make[1]: *** [scripts/kconfig/conf] Error 1

make: *** [whgs_defconfig] Error 2

4.参考:

其好像是,加了上面那个-lintl后,就解决问题了。

而此处我没有解决。

然后看了看makefile,好像是hostcc去编译.o的时候,加上的此库。

所以,重新去clean一下:CLi@PC-CLI-1 ~/develop/kernel/linux-2.6.19.1

$ make clean

再make一下试试,结果错误依旧。

5.参考:

中的patch:

然后把makefile改为:# ===========================================================================

# Local mods. This is for cygwin-hosted builds. Should be harmlessly

# superfluous on Linux platforms where libintl functionality is in glibc.

ifeq (${OSTYPE},cygwin)

HOST_LOADLIBES := -lintl

endif

# ===========================================================================

# Kernel configuration targets

# These targets are used from top-level makefile

再去编译试试,结果错误依旧。

6.再去改为:# ===========================================================================

# Local mods. This is for cygwin-hosted builds. Should be harmlessly

# superfluous on Linux platforms where libintl functionality is in glibc.

#ifeq (${OSTYPE},cygwin)

#HOST_LOADLIBES := -lintl

#endif

IS_CYGWIN=$(shell uname | grep -i cygwin > /dev/null 2>&1 && echo yes || echo no)

ifeq ($(IS_CYGWIN),yes)

HOST_LOADLIBES := -lintl

endif

# ===========================================================================

# Kernel configuration targets

# These targets are used from top-level makefile

试试,结果错误依旧。

7.怀疑是否调用到该行了。所以故意改错为:IS_CYGWIN=$(shell uname | grep -i cygwin > /dev/null 2>&1 && echo yes || echo no)

ifeq ($(IS_CYGWIN),yes)

HOST_LOADLIBES := -lxxxxx

endif

然后运行看看是否出错,结果错误无任何变化,说明根本没有执行到这句。

8.然后把对应的配置,加到合适的位置:# Use reursively expanded variables so we do not call gcc unless

# we really need to do so. (Do not call gcc as part of make mrproper)

HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)

HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

#ifeq (${OSTYPE},cygwin)

#HOST_LOADLIBES := -lintl

#endif

IS_CYGWIN=$(shell uname | grep -i cygwin > /dev/null 2>&1 && echo yes || echo no)

ifeq ($(IS_CYGWIN),yes)

HOST_LOADLIBES += -lintl

endif

HOST_EXTRACFLAGS += -DLOCALE

PHONY += $(obj)/dochecklxdialog

$(obj)/dochecklxdialog:

$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)

always := dochecklxdialog

再运行看看效果,然后终于是可以解决此问题了,至少是可以找到对应的库函数了,可以正常ld了。

【总结】

在cygwin下,交叉编译kernel,结果出现:scripts/kconfig/conf.o:conf.c:(.text+0x1f): undefined reference to `libintl_gettext’

的错误的:

原因是:

当是cygwin时,缺少对应的-lintl的库。

解决办法是:

想办法,在makefile中,添加上对应库-lintl即可。

修改:

linux-2.6.19.1\scripts\kconfig\Makefile

改为:# Use reursively expanded variables so we do not call gcc unless

# we really need to do so. (Do not call gcc as part of make mrproper)

HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)

HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))

#ifeq (${OSTYPE},cygwin)

#HOST_LOADLIBES := -lintl

#endif

IS_CYGWIN=$(shell uname | grep -i cygwin > /dev/null 2>&1 && echo yes || echo no)

ifeq ($(IS_CYGWIN),yes)

HOST_LOADLIBES += -lintl

endif

HOST_EXTRACFLAGS += -DLOCALE

PHONY += $(obj)/dochecklxdialog

$(obj)/dochecklxdialog:

$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES)

always := dochecklxdialog

即可。

但是接着又出现,类似于之前的:

的错误:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值