Ubuntu中crosstool-ng编译出错:[ERROR] gtype-desc.c:8829:18: error: subscripted value is neither array nor

参考资料:http://www.crifan.com/files/doc/docbook/crosstool_ng/release/htmls/crosstool_ng_config_para.html#eg.restore_from_fail_step

【问题】

折腾:

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

编译出错:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
crifan@ubuntu:~ /develop/crosstool-ng/crosstool-ng-1 .18.0_build$ ct-ng build
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20130807.235739
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[EXTRA]  Installing user-supplied crosstool-NG configuration
[EXTRA]  =================================================================
[EXTRA]  Dumping internal crosstool-NG configuration
[EXTRA]    Building a toolchain for :
[EXTRA]      build  = i686-pc-linux-gnu
[EXTRA]      host   = i686-pc-linux-gnu
[EXTRA]      target = arm-xscale-linux-gnueabi
[EXTRA]  Dumping internal crosstool-NG configuration: done in 0.09s (at 00:02)
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[EXTRA]    Using 'linux-custom' from custom location
[INFO ]  Retrieving needed toolchain components' tarballs: done in 0.30s (at 00:02)
[INFO ]  =================================================================
[INFO ]  Extracting and patching toolchain components
[EXTRA]    Extracting 'linux-custom'
[EXTRA]    Extracting 'gmp-5.0.2'
[EXTRA]    Patching 'gmp-5.0.2'
[EXTRA]    Extracting 'mpfr-3.1.0'
[EXTRA]    Patching 'mpfr-3.1.0'
[EXTRA]    Extracting 'mpc-0.9'
[EXTRA]    Patching 'mpc-0.9'
[EXTRA]    Extracting 'libelf-0.8.13'
[EXTRA]    Patching 'libelf-0.8.13'
[EXTRA]    Extracting 'binutils-2.22'
[EXTRA]    Patching 'binutils-2.22'
[EXTRA]    Extracting 'gcc-4.6.0'
[EXTRA]    Patching 'gcc-4.6.0'
[EXTRA]    Extracting 'glibc-2.9'
[EXTRA]    Patching 'glibc-2.9'
[EXTRA]    Extracting 'glibc-ports-2.9'
[EXTRA]    Patching 'glibc-ports-2.9'
[EXTRA]    Extracting 'dmalloc-5.5.2'
[EXTRA]    Patching 'dmalloc-5.5.2'
[EXTRA]    Extracting 'gdb-6.8a'
[EXTRA]    Patching 'gdb-6.8a'
[EXTRA]    Extracting 'ncurses-5.9'
[EXTRA]    Patching 'ncurses-5.9'
[EXTRA]    Extracting 'expat-2.1.0'
[EXTRA]    Patching 'expat-2.1.0'
[EXTRA]    Extracting 'ltrace-0.5.3'
[EXTRA]    Patching 'ltrace-0.5.3'
[EXTRA]    Extracting 'strace-4.5.19'
[EXTRA]    Patching 'strace-4.5.19'
[INFO ]  Extracting and patching toolchain components: done in 89.30s (at 01:32)
[EXTRA]  Saving state to restart at step 'libc_check_config' ...
[EXTRA]  Saving state to restart at step 'companion_libs_for_build' ...
[EXTRA]  Saving state to restart at step 'binutils_for_build' ...
[EXTRA]  Saving state to restart at step 'companion_libs_for_host' ...
[INFO ]  =================================================================
[INFO ]  Installing GMP for host
[EXTRA]    Configuring GMP
[EXTRA]    Building GMP
[EXTRA]    Installing GMP
[INFO ]  Installing GMP for host: done in 50.61s (at 02:23)
[INFO ]  =================================================================
[INFO ]  Installing MPFR for host
[EXTRA]    Configuring MPFR
[EXTRA]    Building MPFR
[EXTRA]    Installing MPFR
[INFO ]  Installing MPFR for host: done in 21.73s (at 02:45)
[INFO ]  =================================================================
[INFO ]  Installing MPC for host
[EXTRA]    Configuring MPC
[EXTRA]    Building MPC
[EXTRA]    Installing MPC
[INFO ]  Installing MPC for host: done in 8.38s (at 02:53)
[EXTRA]  Saving state to restart at step 'binutils_for_host' ...
[INFO ]  =================================================================
[INFO ]  Installing binutils for host
[EXTRA]    Configuring binutils
[EXTRA]    Building binutils
[EXTRA]    Installing binutils
[INFO ]  Installing binutils for host: done in 71.16s (at 04:05)
[EXTRA]  Saving state to restart at step 'cc_core_pass_1' ...
[INFO ]  =================================================================
[INFO ]  Installing pass-1 core C compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[ERROR]    gtype-desc.c:8829:18: error: subscripted value is neither array nor pointer nor vector
[ERROR]    gtype-desc.c:8948:36: error: subscripted value is neither array nor pointer nor vector
[ERROR]    gtype-desc.c:9032:31: error: subscripted value is neither array nor pointer nor vector
[ERROR]    gtype-desc.c:9053:31: error: subscripted value is neither array nor pointer nor vector
[ERROR]    gtype-desc.c:9060:31: error: subscripted value is neither array nor pointer nor vector
[ERROR]    gtype-desc.c:9067:31: error: subscripted value is neither array nor pointer nor vector
[ERROR]    make [2]: *** [gtype-desc.o] Error 1
[ERROR]    make [1]: *** [all-gcc] Error 2
[ERROR]  
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing pass-1 core C compiler'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in : CT_DoExecLog[scripts /functions @257]
[ERROR]  >>        called from: do_cc_core_backend[scripts /build/cc/gcc .sh@448]
[ERROR]  >>        called from: do_cc_core_pass_1[scripts /build/cc/gcc .sh@101]
[ERROR]  >>        called from: main[scripts /crosstool-NG .sh@632]
           
 
Current command :
   'make' '-j4' '-l' 'all-gcc'
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/.build /arm-xscale-linux-gnueabi/build/build-cc-core-pass-1 >

即:

[ERROR] gtype-desc.c:8829:18: error: subscripted value is neither array nor pointer nor vector

subscripted value is neither array nor pointer nor vector

 

【解决过程】

1.参考:

Bug 52986 – x86_64 GCC 4.7.0 can’t compile x86 GCC 4.6.2; gtype-desc.c

->

Bug 51969 – [4.6 regression] trunk gcc unable to build gcc 4.6

去修改gtype-desc.c,结果找不到这个文件。

2.然后去修改:

gcc/gengtype.c

?
1
crifan@ubuntu:~ /develop/crosstool-ng/crosstool-ng-1 .18.0_build/.build /src/gcc-4 .6.0 /gcc $ gedit gengtype.c

找到write_field_root,改为:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
static void
write_field_root (outf_p f, pair_p v , type_p type , const char *name,
           int has_length, struct fileloc *line, const char *if_marked,
           bool emit_pch, type_p field_type, const char *field_name)
{
   struct pair newv;
   /* If the field reference is relative to V, rather than to some
      subcomponent of V, we can mark any subarrays with a single stride.
      We're effectively treating the field as a global variable in its
      own right.  */
   if ( v && type == v -> type )
     {
       //struct pair newv;
 
       newv = * v ;
       newv. type = field_type;

然后再去重新编译:

input exit 2 to rebuild gcc

然后就可以继续编译了:

can continue to build no error

 

【总结】

编译gcc 4.6时出现:

[ERROR] gtype-desc.c:8829:18: error: subscripted value is neither array nor pointer nor vector

时,解决办法是:

(在

crosstool-ng-1.18.0_build/.build/src

下面的)

gcc-4.6.0/gcc/gengtype.c

中的函数write_field_root中的

?
1
struct pair newv;

移到最开始声明处,即改为这样:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
static void
write_field_root (outf_p f, pair_p v , type_p type , const char *name,
           int has_length, struct fileloc *line, const char *if_marked,
           bool emit_pch, type_p field_type, const char *field_name)
{
   struct pair newv;
   /* If the field reference is relative to V, rather than to some
      subcomponent of V, we can mark any subarrays with a single stride.
      We're effectively treating the field as a global variable in its
      own right.  */
   if ( v && type == v -> type )
     {
       //struct pair newv;
 
       newv = * v ;
       newv. type = field_type;

即可。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值