1
我想編譯uClibc 0.9.33.2爲我的舊路由器Ubicom IP7k處理器。由於架構並未得到GCC和uClibc的正式支持,我必須自己移植它,並使用處理器供應商的GCC(ubicom32-uclinux-gcc (GCC) 4.4.1 20100320 (stable)
)的修改版本。一切都很好,直到GCC向我展示了一個奇怪的錯誤。GCC無法編譯正確的代碼
CC libc/sysdeps/linux/common/fstatat.os
In file included from libc/sysdeps/linux/common/xstatconv.h:26,
from libc/sysdeps/linux/common/fstatat.c:11:
./include/bits/kernel_stat.h:25: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
./include/bits/kernel_stat.h:52: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
make: *** [libc/sysdeps/linux/common/fstatat.os] Error 1
kernel_stat.h:
#ifndef _BITS_STAT_STRUCT_H
#define _BITS_STAT_STRUCT_H
#ifndef _LIBC
#error bits/kernel_stat.h is for internal uClibc use only!
#endif
/* This file provides whatever this particular arch's kernel thinks
* struct kernel_stat should look like... It turns out each arch has a
* different opinion on the subject... */
struct kernel_stat {
unsigned short st_dev;
unsigned short __pad1;
unsigned long st_ino;
unsigned short st_mode;
unsigned short st_nlink;
unsigned short st_uid;
unsigned short st_gid;
unsigned short st_rdev;
unsigned short __pad2;
unsigned long st_size;
unsigned long st_blksize;
unsigned long st_blocks;
unsigned long st_atime; <-- error occurs here
unsigned long __unused1;
unsigned long st_mtime;
unsigned long __unused2;
unsigned long st_ctime;
unsigned long __unused3;
unsigned long __unused4;
unsigned long __unused5;
};
struct kernel_stat64 {
unsigned char __pad0[6];
unsigned short st_dev;
unsigned char __pad1[4];
#define _HAVE_STAT64___ST_INO
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned char __pad2[6];
unsigned short st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long st_blocks; /* Number 512-byte blocks allocated. */
unsigned long __pad4; /* future possible st_blocks high bits */
unsigned long st_atime; <-- and here
unsigned long __pad5;
unsigned long st_mtime;
unsigned long __pad6;
unsigned long st_ctime;
unsigned long __pad7; /* will be high 32 bits of ctime someday */
unsigned long long st_ino;
};
#endif /* _BITS_STAT_STRUCT_H */
到底出了什麼這裏有沒有什麼辦法解決它,而不必更新GCC?
你可以看一看'gcc -E'生成的輸出在預處理後查看實際的源代碼,看看是否會引發任何麻煩的宏擴展... – vanza 2014-10-18 22:27:29
宏 - 那些有時會使得合理的東西將代碼看成完全不同的東西。由於幾乎每次我看到「預期」:',',',',','...錯誤是由於宏觀問題導致的,我希望診斷在某些原因中會提到宏。與此同時,我在腦海裏陷入了錯誤和宏觀之間的聯繫。 – 2014-10-18 22:50:46