【问题】
折腾:
【记录】Ubuntu下用crosstool-ng为xscale建立交叉编译器arm-xscale-linux-gnueabi-gcc
编译出错:
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 |
【解决过程】
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
crifan@ubuntu:~/develop/crosstool-ng/crosstool-ng-1.18.0_build/.build/src/gcc-4.6.0/gcc$ gedit gengtype.c
找到write_field_root,改为:
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;然后再去重新编译:
然后就可以继续编译了:
【总结】
编译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中的
struct pair newv;
移到最开始声明处,即改为这样:
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;即可。
转载请注明:在路上 » 【已解决】Ubuntu中crosstool-ng编译出错:[ERROR] gtype-desc.c:8829:18: error: subscripted value is neither array nor pointer nor vector