Ubuntu 10.04下TinyOS无法编译的问题

此前还跟朋友说Ubuntu下的TinyOS很稳定,不管怎么瞎整都没事。因为此前有个同事,用的是Fedora,系统更新一次TinyOS就立马不行了。现在看来我说错了,今天我的TinyOS也起不来了。以前系统也经常更新,但是从来没遇到过问题,最近一段时间没怎么摆弄它,所以也不知道是哪次系统升级把它整坏了,就连编译最简单的Blink都不行。重装了N遍都无法解决。

症状如下,在终端内输入编译命令“make telosb”,直接给我甩回来一长串的syntax error,自带的例程怎么还可能有语法错误?!错误信息的前两行是

mkdir -p build/telosb
    compiling BlinkAppC to a telosb binary
ncc -o build/telosb/main.exe  -Os -O -mdisable-hwmul -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board= -DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"shouyanbo\" -DIDENT_HOSTNAME=\"yanbo-thinkpad\" -DIDENT_USERHASH=0x38722225L -DIDENT_TIMESTAMP=0x4d5e9b04L -DIDENT_UIDHASH=0xd22d1fe1L  BlinkAppC.nc -lm
/usr/lib/ncc/deputy_nodeputy.h:4:20: error: stddef.h: No such file or directory
/usr/lib/ncc/nesc_nx.h:14:26: error: sys/inttypes.h: No such file or directory然后接下去还有一长串的语法错误信息:

/usr/lib/ncc/nesc_nx.h:235: syntax error before `__nesc_ntoh_uint8'
/usr/lib/ncc/nesc_nx.h:240: syntax error before `__nesc_hton_uint8'
/usr/lib/ncc/nesc_nx.h:242: warning: type defaults to `int' in declaration of `base'
/usr/lib/ncc/nesc_nx.h:242: `value' undeclared here (not in a function)
/usr/lib/ncc/nesc_nx.h:242: warning: data definition has no type or storage class
/usr/lib/ncc/nesc_nx.h:243: syntax error before `return'
/usr/lib/ncc/nesc_nx.h:246: syntax error before `__nesc_ntoh_leuint8'
/usr/lib/ncc/nesc_nx.h:251: syntax error before `__nesc_hton_leuint8'
/usr/lib/ncc/nesc_nx.h:253: warning: type defaults to `int' in declaration of `base'
/usr/lib/ncc/nesc_nx.h:253: redefinition of `base'
/usr/lib/ncc/nesc_nx.h:242: previous declaration of `base'
/usr/lib/ncc/nesc_nx.h:253: `value' undeclared here (not in a function)
/usr/lib/ncc/nesc_nx.h:253: warning: data definition has no type or storage class
/usr/lib/ncc/nesc_nx.h:254: syntax error before `return'
/usr/lib/ncc/nesc_nx.h:257: syntax error before `__nesc_ntoh_int8'
/usr/lib/ncc/nesc_nx.h:257: syntax error before `__nesc_hton_int8'
/usr/lib/ncc/nesc_nx.h:257: syntax error before `__nesc_ntoh_leint8'
/usr/lib/ncc/nesc_nx.h:257: syntax error before `__nesc_hton_leint8'
/usr/lib/ncc/nesc_nx.h:258: syntax error before `__nesc_bf_decode8'
etc.而且问题好像是针对Telob的,编译micaz一点问题没有,“make micaz”运行地好好的。

Google了好一阵子终于找到了解决方法。打开文件/opt/tinyos-2.1.1/support/make/msp/msp.rules,在

OBJCOPY = msp430-objcopy
OBJDUMP = msp430-objdump
两行前加入

CFLAGS += -I/usr/msp430/include
CFLAGS += -I/usr/lib/gcc-lib/msp430/3.2.3/include
保存、退出,问题解决。

按照原帖子作者自己的说法是,这是个“偏方”,具体是什么原因造成这个问题的,有没有更“漂亮”的办法来解决它,不知道。说白了就是凑活着用。想想也是,我们是用TinyOS,这种问题就留给TinyOS的开发人员吧。

现在已经把Ubuntu的自动更新禁用了,以后就手动给需要的软件升级了,不瞎升了,系统稳定最重要。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/25002.html