This document will be of use to advanced users of WebbotLib.
The instructions in this document explain how to build the WebbotLib libraries from source code.
WebbotLib already comes with pre-built libraries so there is no reason to do this unless you are doing something non standard.
This document does not explain how to use WebbotLib. That information is in the .pdf file in the WebbotLib archive.
This document does not contain information on uploading compiled code to an AVR.
| C:\> java -version java version "1.6.0_11" Java(TM) SE Runtime Environment (build 1.6.0_11-b03) Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing) |
First use your package manager to verify you have a reasonably up to date version of JDK on your system.
On any Debian based system (Ubuntu, etc) do the following:
| $ dpkg --get-selections | grep jdk openjdk-6-jdk install openjdk-6-jre install openjdk-6-jre-headless install openjdk-6-jre-lib install |
Sun Java 6 JDK is probably better but either will do.
In the unlikely event you have something older on your system use your package manager to upgrade.
Next, use your package manager to install ant.
On my system it was as simple as:
| $ sudo apt-get install ant |
| $ ant clean Buildfile: build.xml clean-lib: [delete] Deleting directory /home/duncan/Geek_projects/avr_projects/WebbotLib/ant clean-examples: clean: BUILD SUCCESSFUL Total time: 2 seconds |
| $ ant Buildfile: build.xml ATMega8: makeone: [echo] Compiling for target = atmega8 to libWebbot-ATMega8.a [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega8 [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega8/Sensors [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega8/Sensors/Voltage [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega8/Sensors/Voltage/Phidget [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega8/Sensors/Temperature [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega8/Sensors/Temperature/Phidget [mkdir] Created dir: /home/duncan/Geek_projects/avr_..................etc. [SNIP] Lots more output removed... [SNIP] ...........................dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega328p/RFTransceiver [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega328p/RFTransceiver/Hope [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega328p/Storage [apply] /home/duncan/Geek_projects/avr_projects/WebbotLib/RFTransceiver/Hope/RF12.c:43: warning: ‘rf12_init’ defined but not used [apply] avr-ar: creating ./libWebbot-ATMega328P.a build-lib: BUILD SUCCESSFUL Total time: 1 minute 20 seconds |
| $ ant -projecthelp Buildfile: build.xml Main targets: ATMega1280 ATMega1280 library ATMega168 ATMega168 library ATMega2560 ATMega2560 library ATMega2561 ATMega2561 library ATMega32 ATMega32 library ATMega328P ATMega328P library ATMega640 ATMega640 library ATMega8 ATMega8 library build-lib Make all libraries clean clean everything clean-examples Clean the examples clean-lib Clean the library examples Examples make-example internal use only makeone internal use only release Create release Default target: build-lib |
| $ ant ATMega2561 Buildfile: build.xml ATMega2561: makeone: [echo] Compiling for target = atmega2561 to libWebbot-ATMega2561.a [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega2561 [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega2561/Sensors [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega2561/Sensors/Voltage [mkdir] Created dir: /home ..................etc. [SNIP] Lots more output removed... [SNIP] ............................................................ rojects/WebbotLib/ant/atmega2561/RFTransceiver/Hope [mkdir] Created dir: /home/duncan/Geek_projects/avr_projects/WebbotLib/ant/atmega2561/Storage [apply] /home/duncan/Geek_projects/avr_projects/WebbotLib/RFTransceiver/Hope/RF12.c:43: warning: ‘rf12_init’ defined but not used [apply] avr-ar: creating ./libWebbot-ATMega2561.a BUILD SUCCESSFUL Total time: 14 seconds |
All well and good but what when things go wrong?
It's worth viewing the contents of build.xml.
Everything in there is nice formated XML so you can view it in a web browser or in a text editor.
Have a look at the <target> tags.
Earlier when you did an "$ ant clean" the <target name="clean" description="clean everything" depends="clean-lib, clean-examples"> rule was invoked.
Take particular notice of the depends= section. These dependencies point to more <target > tags which will also be run.
Ant's default action is set here: <project name="My Project" default="build-lib" basedir=".">
The default="build-lib" section sends ant to the <target name="build-lib"> section if you don't specify one your self.
Most
problems are fairly straight forward. Ant is just invoking other
command line tools so look for familiar debug output from them.
Any problems i have seen so far are related to incorrect filenames or paths.
Eg:
| $ ant clean Buildfile: build.xml clean-lib: [delete] Deleting directory /home/duncan/Geek_projects/avr_projects/WebbotLib/ant clean-examples: BUILD FAILED /home/duncan/Geek_projects/avr_projects/WebbotLib/build.xml:25: Directory does not exist:/home/duncan/Geek_projects/avr_projects/WebbotLib/examples Total time: 0 seconds |
Can be fixed by simply adding the missing ./examples directory.
Good luck!