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

【已解决】Ubuntu中crosstool-ng编译出错:scripts/unifdef.c:209:25: error: conflicting types for ‘getline’

crosstool-ng crifan 4154浏览 0评论

【问题】

折腾:

【记录】Ubuntu下用crosstool-ng为xscale建立交叉编译器arm-xscale-linux-gnueabi-gcc

出错:

[INFO ]  =================================================================
[INFO ]  Installing kernel headers
[EXTRA]    Installing kernel headers
[ERROR]    /home/crifan/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts/unifdef.c:209:25: error: conflicting types for 'getline'
[ERROR]    make[3]: *** [scripts/unifdef] Error 1
[ERROR]    make[2]: *** [headers_install] Error 2
[ERROR]    make[1]: *** [headers_install] Error 2
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing kernel headers'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_kernel_install[scripts/build/kernel/linux.sh@112]
[ERROR]  >>        called from: do_kernel_headers[scripts/build/kernel/linux.sh@91]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@632]
          

Current command:
  'make' '-C' '/home/crifan/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom' 'O=/home/crifan/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/arm-xscale-linux-gnueabi/build/build-kernel-headers' 'ARCH=arm' 'INSTALL_HDR_PATH=/home/crifan/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/arm-xscale-linux-gnueabi/sysroot/usr' 'V=0' 'headers_install' 
exited with error code: 2
Please fix it up and finish by exiting the shell with one of these values:
    1  fixed, continue with next build command
    2  repeat this build command
    3  abort build

ct-ng:~/develop/crosstool-ng/crosstool-ng-1.18.0_build> 

即:

scripts/unifdef.c:209:25: error: conflicting types for ‘getline’

scripts unifdef c error conflicting types for getline

 

【解决过程】

1.这个是之前就遇到的,所以参考之前的:

【已解决】crosstool-ng在Installing kernel headers时出错:[ERROR] /xxx/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts/unifdef.c:209:25: error: conflicting types for ‘getline’

去修改

crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ pwd
/home/crifan/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/linux-custom/scripts$ gedit unifdef.c 

为:

//static Linetype         getline(void);
static Linetype         get_line(void);

	for (;;) {
		linenum++;
		//lineval = getline();
		lineval = get_line();
		trans_table[ifstate[depth]][lineval]();

static Linetype
//getline(void)
get_line(void)
{

即可。

 

【总结】

当出现:

scripts/unifdef.c:209:25: error: conflicting types for ‘getline’

修改linux下面的scripts/unifdef.c把(共3处的)getline改为别的名字,比如get_line:

//static Linetype         getline(void);
static Linetype         get_line(void);

	for (;;) {
		linenum++;
		//lineval = getline();
		lineval = get_line();
		trans_table[ifstate[depth]][lineval]();

static Linetype
//getline(void)
get_line(void)
{

即可。

转载请注明:在路上 » 【已解决】Ubuntu中crosstool-ng编译出错:scripts/unifdef.c:209:25: error: conflicting types for ‘getline’

发表我的评论
取消评论

表情

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

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