Thursday, January 1, 2009

Installing TinyOS-2.x in Ubuntu intrepid (8.10)

1) add bellow repository to your /etc/apt/sources.list though it is for hardy, it is working for intrepid also

deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main

2) with following commands you can update the apt-cache and search the required packages thin you can install the required version and all.

apt-get update
apt-cache search tinyos
apt-get install tinyos-2.1.0

3) then install python development package (headers)

apt-get install python-dev

4) Edit /opt/tinyos-2.1.0/tinyos.sh and change the CLASSPATH env-variable as bellow

CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java/tinyos.jar:.

4) Import /opt/tinyos-
2.1.0/tinyos.sh in your .bashrc; include bellow code snippet to ~/.bashrc

if [ -f /opt/tinyos-
2.1.0/tinyos.sh ] ; then
. /opt/tinyos-
2.1.0/tinyos.sh
fi

5) Now execut bash again or restart the terminal and chech your enviorenment with bellow command. It will check the enviorenment and report you the status. (Ignore the WORNING returned due to graphvis version)

tos-check-env

6) Lets compile the first application

cd $TOSROOT/apps/Blink
make micaz

for simulator

make micaz sim

have fun!~

25 comments:

  1. I have tried to install TinyOS 2.1.0 but I got the following error:

    E: /var/cache/apt/archives/avr-gcc-tinyos_4.1.2-20080806_i386.deb:
    trying to overwrite `/usr/lib/libiberty.a', which is also in package
    binutils-dev
    any help

    ReplyDelete
  2. In my case I have not installed binutils-dev. If you want to keep binutils-dev, rename /usr/lib/libiberty.a (or if you don't need binutils-dev at the moment remove it) and install avr-gcc-tinyos again

    ReplyDelete
  3. getting a warning...

    WARNING: The JAVA version found first by tos-check-env may not be version 1.4 or version 1.5one of which is required by TOS. Please ensure that the located Java version is 1.4 or 1.5


    I have java 1.6...is Tiny OS compatible with it??

    ReplyDelete
  4. Though I'm using 1.5 it is compatible with 1.6 see this link
    http://docs.tinyos.net/index.php/Installing_TinyOS_2.1

    ReplyDelete
  5. Worked fine for me! But why do I need the python-dev package?

    ReplyDelete
  6. In tinyos-2.x TOSSIM is a library: you must write a program that configures a simulation and runs it. TOSSIM supports two programming interfaces: Python and C++. Python allows you to interact with a running simulation dynamically, like a powerful debugger. However, since the interpretator can be a performance bottleneck when obtaining results, TOSSIM also has a C++ interface. Usually, transforming code from one to the other is very simple.
    see http://docs.tinyos.net/index.php/TOSSIM for more information

    ReplyDelete
  7. Hi, thank U for the post, still I encountered problems. When doing "apt-get install tinyos-2.1.0" I receive an error:
    Errors:
    /var/cache/apt/archives/avr-binutils-tinyos_2.17-20080806_i386.deb
    /var/cache/apt/archives/avr-gcc-tinyos_4.1.2-20080806_i386.deb
    /var/cache/apt/archives/avr-libc-tinyos_1.4.7-20080806_i386.deb
    /var/cache/apt/archives/avrdude-tinyos_5.4-20080806_i386.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    The repository is the same you are giving and I've tried a lot of things.

    Can you help, please?

    ReplyDelete
  8. Try,
    sudo apt-get --purge autoremove tinyos-2.1.0
    sudo apt-get install tinyos-2.1.0

    ReplyDelete
  9. Hi, thanks for this tutorial but I have some problems. The result of the 'apt-get install tinyos-2.1.0', I have this errors:
    Errors were encountered while processing:
    /var/cache/apt/archives/avr-gcc-tinyos_4.1.2-20080806_i386.deb
    /var/cache/apt/archives/msp430-binutils-tinyos_2.17-20080806_i386.deb
    /var/cache/apt/archives/msp430-gcc-tinyos_3.2.3-20080806_i386.deb
    /var/cache/apt/archives/msp430-libc-tinyos_20060801cvs-20080806_i386.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    This is not the same of marina errors.

    Can you help me?
    Thanks
    Captren

    ReplyDelete
  10. Looks like some packages are broken in given repository probably they will fixed in future.

    Try to install packages manually. Follow the instruction given in this wiki:

    http://docs.tinyos.net/index.php/Installing_TinyOS_2.1

    Download and convert rpm packages to deb using alien
    alien -d --scripts package_name.rpm

    Then install all the packages at once using
    dpkg -iRE *.deb

    If you encounter any dependancyy problem us
    apt-get -f install

    to fix them

    you will be fine...

    ReplyDelete
  11. This comment has been removed by the author.

    ReplyDelete
  12. Hi guys!

    Excellents tips, laxaman! Thanks!

    I'm starting on TinyOS, when i was installing it i had a problem with 'avrdude-tinyos_5.4-20080806_i386.deb', so following your tip, i dowloaded and converted the package 'avrdude-tinyos_5.6cvs-2_i386.rpm'. I just installed this package.

    I executed 'sudo apt-get -f install', to ensure that all working.

    My question is:

    "Will i have any problem in the future, because i just installed this package?!?"

    I'm from Brasil.

    Sorry my english, i know a little.


    Regards


    Rodrigo M. Palheta

    ReplyDelete
  13. there will not be any problem.
    But if you try to upgrade the system, prevent replacing your manually installed packages

    ReplyDelete
  14. Thanx man i have juat started working on ubuntu 8.10 intrepid (iris platform). I followed the above steps n everything came well.
    cheers

    ReplyDelete
  15. Hi,

    I came across your blog, when i was searching for TOSSIM installation. I am new to UBUNTU and TOSSIM. I have installed Ubuntu 9, following ur steps for TOSSIM instructions, I added the deb http://... to the sources.list. But after that when i type apt-get update, the message i get is "Could not open lock file /var/lib/apt/lists/lock-open (13 Permission Denied).

    I get the same error message for the third command also. How do i proceed, can u help me. I need to get working fast.
    Thanks
    Mohana (ssmvalli@gmail.com)

    ReplyDelete
  16. Hi Mohana,


    You have to use "sudo"


    $sudo apt-get install tinyos-2.1

    ReplyDelete
  17. Hi rodrigomp

    Thanks a lot for ur help, i installed TOSSIm and the tos-check-env command too works, except for the warning. But the application blink is giving me error.When i typed cd $TOSROOT/apps/Blink it says no such directory found. what mistake have i done.

    Please help me
    Thanks

    ReplyDelete
  18. Hi,

    I figured out what i should have done, my Tinyos is in /opt....
    so i gave cd /opt/tinyos-2.1.0/apps/Blink
    then i gave make micaz sim but i am getting this error
    make:*** No rule to make target 'micaz'. Stop.

    Please help me
    Thanks

    ReplyDelete
  19. Check whether MAKERULES environment variable is set

    run:

    echo $MAKERULES

    otherwise check step 4) above

    ReplyDelete
  20. Hi,

    I checked with echo $MAKERULES, there is no message
    I just get the $ prompt, should i re install.U had said check Step 4 and above. I am new to linux, so can u please elaborate.

    Thanks

    ReplyDelete
  21. MAKERULES is an environment variable which points to a file which contains the generic make rules for many platforms. The make file which is in your project is just a dummy which includes the MAKERULES file.

    What step 4 does is including the file which contain the envirenment setting related stuff from /opt/tinyos-2.1.0/tinyos.sh


    In step 4 what you have to do is

    change CLASSPATH= line as
    CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java/tinyos.jar:.

    NOTE: last dot (.) is also required
    and

    include bellow code snippet at the end of .bashrc file which is in you linux home directory (~/.bashrc)

    if [ -f /opt/tinyos-2.1.0/tinyos.sh ] ; then
    . /opt/tinyos-2.1.0/tinyos.sh
    fi


    Then when your starting a terminal(bash), environment for Tinyos development will be automatically set

    ReplyDelete
  22. hello,

    i have successfully installed tinyos from the repository and included the source file in my bashrc.

    I tried to make a simple example like Blink and i get this kind of errors:

    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:26:20: error: Python.h: No such file or directory
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:296: error: ISO C++ forbids declaration of ‘PyObject’ with no type
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:296: error: expected ‘;’ before ‘*’ token
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:297: error: ‘PyObject’ has not been declared
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:302: error: ‘PyObject_HEAD’ does not name a type
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:306: error: expected initializer before ‘*’ token
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:313: error: ‘FILE’ has not been declared
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx: In function ‘int swig_varlink_print(swig_varlinkobject*, int*, int)’:
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:316: error: ‘fprintf’ was not declared in this scope
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:317: error: ‘struct swig_varlinkobject’ has no member named ‘vars’
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx: At global scope:
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:325: error: expected initializer before ‘*’ token
    /opt/tinyos-2.1.0/tos/lib/tossim/tossim_wrap.cxx:3496: error: expected `}' at end of input
    make: *** [sim-exe] Error 1

    i tried others examples and keep getting errors.What is wrong?

    ReplyDelete
  23. ok i found it....yes that was the problem!

    now i am trying to use tossim.

    For example i try Blink and python and c++ objects are created, what do i execute next to visualize my simulation?....

    thanx for the reply and the help!

    ReplyDelete
  24. Hi, I'm new at tinyos and I'm having trouble with TOSSIM. I understand that tossim is a library and it seems that I have it on the directory /opt/tinyos-2.1.0/tos/lib/tossim . But when I try the command make micaz sim on the Blink directory I get back lots of errors including some TossimActiveMessageC saying it's not implemented. I would like to know if there is something I have to download other then the archives mentioned on the steps of this tutorial or if there is something wrong with my installation.

    Thanks a lot for the help!

    ReplyDelete