最近在编译QT4.8.4的X86版本时都出现如下错误,从网上查到解决方法如下:
出错信息:
/usr/include/linux/futex.h:96: 错误:‘u32’ 在此作用域中尚未声明
/usr/include/linux/futex.h:96: 错误:‘uaddr’ 在此作用域中尚未声明
/usr/include/linux/futex.h:96: 错误:expected primary-expression before ‘int’
/usr/include/linux/futex.h:96: 错误:‘u32’ 在此作用域中尚未声明
/usr/include/linux/futex.h:96: 错误:expected primary-expression before ‘unsigned’
/usr/include/linux/futex.h:97: 错误:‘u32’ 在此作用域中尚未声明
/usr/include/linux/futex.h:97: 错误:‘uaddr2’ 在此作用域中尚未声明
/usr/include/linux/futex.h:97: 错误:‘u32’ 在此作用域中尚未声明
/usr/include/linux/futex.h:97: 错误:‘u32’ 在此作用域中尚未声明
/usr/include/linux/futex.h:97: 错误:initializer 表达式列表被看作复合表达式
/usr/include/linux/futex.h:100: 错误:‘u32’ 在此作用域中尚未声明
/usr/include/linux/futex.h:100: 错误:‘uaddr’ 在此作用域中尚未声明
/usr/include/linux/futex.h:100: 错误:expected primary-expression before ‘struct’
/usr/include/linux/futex.h:100: 错误:expected primary-expression before ‘int’
/usr/include/linux/futex.h:100: 错误:initializer 表达式列表被看作复合表达式
make[1]: *** [.obj/release-shared/qmutex_unix.o] 错误 1
make[1]: Leaving directory `/home/qt/qt-everywhere-opensource-src-4.8.4/src/corelib'
make: *** [sub-corelib-make_default-ordered] 错误 2
解决方法:
使用gmake编译前需要修改/usr/include/linux/futex.h:
(1)在第4行前插入下面内容:
#include <linux/types.h>
(2)替换第96行至100行之间的“u32”为“__u32”,行数不一定是96-100,把这个改一下就行了,u32前面是两个下划线__,而不是一个_
long do_futex(u32 *uaddr, int op, u32 val, unsigned long timeout,
u32 *uaddr2, u32 val2, u32 val3);
extern int
handle_futex_death(u32 *uaddr, struct task_struct *curr, int pi);