歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu 10.04下TinyOS無法編譯的問題

Ubuntu 10.04下TinyOS無法編譯的問題

日期:2017/2/28 16:21:49   编辑:Linux教程

此前還跟朋友說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的自動更新禁用了,以後就手動給需要的軟件升級了,不瞎升了,系統穩定最重要。

Copyright © Linux教程網 All Rights Reserved