Linux交叉编译问题strace解决 signalfd.c:15: xlat/sfd_flags.h:17: error: size of array 'type name' is negative
生活随笔
收集整理的這篇文章主要介紹了
Linux交叉编译问题strace解决 signalfd.c:15: xlat/sfd_flags.h:17: error: size of array 'type name' is negative
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
產(chǎn)品不是很穩(wěn)定,執(zhí)行shell容易出現(xiàn)段錯誤,為了定位打算移植strace到嵌入式板子上,環(huán)境是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 2Google了半天也沒看有好的解決辦法,后來看到一個類似的問題,它的解決方法是將報錯的地方給注釋掉了;-),嘿,還別說,這招還真有效。編譯果然通過了。
//定義一個空函數(shù),不做檢查 # 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])]*/實(shí)際測試不影響使用,靈活編譯解決問題!
總結(jié)
以上是生活随笔為你收集整理的Linux交叉编译问题strace解决 signalfd.c:15: xlat/sfd_flags.h:17: error: size of array 'type name' is negative的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ubuntu 12.04 交叉编译 ar
- 下一篇: u盘启动iso模式怎么使用教程 U盘如何