Linux交叉编译问题strace解决 signalfd.c:15: xlat/sfd_flags.h:17: error: size of array 'type name' is negative

产品不是很稳定,执行shell容易出现段错误,为了定位打算移植strace到嵌入式板子上,环境是MIPS平台,从github上下载的strace源码,编译ARM平台通过( ubuntu 12.04 交叉编译 arm 平台的 strace),但是编译MIPS平台的时候报如下错误:

mips-linux-gcc-4.3.6 -std=gnu99 -DHAVE_CONFIG_H   -I./linux/mips -I./linux/mips -I./linux -I./linux -I. -I.      -Wall -Wempty-body -Wformat-security -Wignored-qualifiers -Winit-self -Wlogical-op -Wmissing-parameter-type -Wnested-externs -Wold-style-declaration -Wold-style-definition -Woverride-init -Wsign-compare -Wtype-limits -Wwrite-strings   -g -O2 -MT strace-signalfd.o -MD -MP -MF .deps/strace-signalfd.Tpo -c -o strace-signalfd.o `test -f 'signalfd.c' || echo './'`signalfd.c
In file included from signalfd.c:15:
xlat/sfd_flags.h:17: error: size of array 'type name' is negative
make[2]: *** [strace-signalfd.o] Error 1
make[2]: Leaving directory `/home/openwrt/project/tmp/strace/strace'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/openwrt/project/tmp/strace/strace'
make: *** [all] Error 2

Google了半天也没看有好的解决办法,后来看到一个类似的问题,它的解决方法是将报错的地方给注释掉了;-),嘿,还别说,这招还真有效。编译果然通过了。


//定义一个空函数,不做检查
#  define static_assert(expr, message) 
	//extern int (*strace_static_assert(int))[sizeof(int[2 * !!(expr) - 1])]


/* 注释掉报错代码
#  define static_assert(expr, message) \
	extern int (*strace_static_assert(int))[sizeof(int[2 * !!(expr) - 1])]
	*/

实际测试不影响使用,灵活编译解决问题!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值