Steps to starting and using the development environment

(for non-developers too)

The Campcaster development environment is not only good for developing Campcaster; it can also be used by people interested in testing the latest builds hot off the Subversion server. Once the development environment is installed, users can easily pull down the very latest code from the Subversion server and run it with minimal effort.

The following steps set up a Campcaster development environment on a clean (K)Ubuntu Dapper and Feisty installation.

1. Install packages

Open a terminal, and copy and paste the following command into it. (Users of other operating systems can get the list of required programs and libraries from  http://campcaster-doc.campware.org/developmentTools.html.)

sudo apt-get install binutils build-essential automake1.8 libtool pkg-config 
patch doxygen tar gzip unzip bzip2 curl bison flex graphviz lcov 
subversion ccache xsltproc flawfinder pwgen 
libgstreamer0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly 
unixodbc-dev odbc-postgresql fontconfig libfontconfig1-dev libpng12-dev 
libjpeg62-dev openssl libssl-dev libxml2-dev libpopt-dev alsa-base 
libasound2-dev libid3tag0-dev libbz2-dev 
libtar-dev libcurl3-dev libboost-date-time-dev libgtk2.0-dev libgtkmm-2.4-dev 
libglademm-2.4-dev libxml++2.6-dev libicu34-dev 
apache2 php5-pgsql libapache2-mod-php5 php-pear php5-gd postgresql-8.1

A few of these packages are in the “universe” repository, which is disabled by default on a fresh install. You can enable it either in Synaptic, or by manually editing the file /etc/apt/sources.list (as root).

If you are using the Feisty release of (K)Ubuntu, you need to cut and paste the following:

sudo apt-get install binutils build-essential automake1.8 libtool pkg-config 
patch doxygen tar gzip unzip bzip2 curl bison flex graphviz lcov 
subversion ccache xsltproc flawfinder pwgen 
libgstreamer0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly 
unixodbc-dev odbc-postgresql fontconfig libfontconfig1-dev libpng12-dev 
libjpeg62-dev openssl libssl-dev libxml2-dev libpopt-dev alsa-base 
libasound2-dev libid3tag0-dev libbz2-dev 
libtar-dev libcurl3-dev libboost-date-time-dev libgtk2.0-dev libgtkmm-2.4-dev 
libglademm-2.4-dev libxml++2.6-dev libicu36-dev libcppunit-dev 
apache2 php5-pgsql libapache2-mod-php5 php-pear php5-gd postgresql-8.2

If you are using the Gutsy release of (K)Ubuntu, you need to cut and paste the following:

sudo apt-get install binutils build-essential automake1.8 libtool pkg-config 
patch doxygen tar gzip unzip bzip2 curl bison flex graphviz lcov 
subversion ccache xsltproc flawfinder pwgen 
libgstreamer0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly 
unixodbc-dev odbc-postgresql fontconfig libfontconfig1-dev libpng12-dev 
libjpeg62-dev openssl libssl-dev libxml2-dev libpopt-dev alsa-base 
libasound2-dev libid3tag0-dev libbz2-dev 
libtar-dev libcurl4-openssl-dev libboost-date-time-dev libgtk2.0-dev libgtkmm-2.4-dev 
libglademm-2.4-dev libxml++2.6-dev libicu36-dev libcppunit-dev 
apache2 php5-pgsql libapache2-mod-php5 php-pear php5-gd postgresql-8.2

If you are using the Hardy release of (K)Ubuntu, you need to cut and paste the following:

sudo apt-get install binutils build-essential automake1.8 libtool pkg-config 
patch doxygen tar gzip unzip bzip2 curl bison flex graphviz lcov 
subversion ccache xsltproc flawfinder pwgen 
libgstreamer0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly 
unixodbc-dev odbc-postgresql fontconfig libfontconfig1-dev libpng12-dev 
libjpeg62-dev openssl libssl-dev libxml2-dev libpopt-dev alsa-base 
libasound2-dev libid3tag0-dev libbz2-dev 
libtar-dev libcurl4-openssl-dev libboost-date-time-dev libgtk2.0-dev libgtkmm-2.4-dev 
libglademm-2.4-dev libxml++2.6-dev libicu-dev libcppunit-dev 
apache2 php5-pgsql libapache2-mod-php5 php-pear php5-gd postgresql-8.3

2. Add your user to the apache group

Use the graphical tool under System/Administration/Users and Groups (if you are using Kubuntu, you’ll find this under System Settings/System Administration/Users) to add your user to the ‘www-data’ group used by the apache web server. (Check “Show all users and groups”, and then select “www-data” in the Groups tab, and click the Properties button.)

A quicker, but more dangerous way is to execute this command:

sudo usermod -G www-data -a <username>

WARNING: enter the command exactly like this. If you forget the ‘-a’ option, for example, you could easily make your system unusable.

You will need to log out and log in again for this change to take effect.

3. Configure Apache and PHP

Go to the /etc/apache2/mods-available directory, and edit the userdir.conf configuration file as root. (For example, type ‘sudo gedit userdir.conf’ or ‘sudo kate userdir.conf’)

Change the line

                AllowOverride FileInfo AuthConfig Limit

to

                AllowOverride FileInfo AuthConfig Limit Options Indexes

save, and close the editor.

If you are using Feisty, you also need to enable the php5 and userdir modules, because they are disabled by default:

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/php5.* .
sudo ln -s ../mods-available/userdir.* .

Next, go to /etc/php5/apache2, and edit php.ini as root. Find the line

error_reporting  =  E_ALL & ~E_NOTICE

and change it to

error_reporting  =  E_ERROR

Next, find the lines

post_max_size = 8M

and

upload_max_filesize = 2M

and increase these limits, say, to 106M and 100M, respectively.

In some cases, your Postgresql extension may not be activated in php. To check this, look at /etc/php5/cli/php.ini, and search for “extension=”. If the following line is missing, then add it, after the other extensions:

extension=pgsql.so

Finally, restart the apache server:

sudo /etc/init.d/apache2 restart

you might get some warnings about the server’s fully qualified domain name; ignore them.

4. Set up ccache

This is optional, but very useful. Execute the following in your home directory:

mkdir bin
cd bin
ln -s /usr/bin/ccache cc
ln -s /usr/bin/ccache gcc
ln -s /usr/bin/ccache g++

If you are using Dapper or Edgy, then edit the ~/.gnomerc file (create it if it does not exist), and add these lines to it:

# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
    PATH=~/bin:"${PATH}"
fi

You need to log out and log in again for this change to take effect. Now would be a good time to do it.

5. Download the latest source code

Execute the following in your home directory to get the latest code from the Subversion server. This will create a ~/src/campcaster directory containing all the source code. You can use a different location, if you want; just adjust the rest of the instructions accordingly.

mkdir src
cd src
svn checkout svn://code.campware.org/campcaster/trunk/campcaster

6. Set up and compile the code

Go to ~/src/campcaster, and type the following to create the necessary databases:

sudo ./bin/user_setup_db.sh --user=<username>

Then type this to compile the code and set up the configuration files:

./bin/setupDevelopmentEnvironment.sh --apache-group=www-data

This will take a long time; but if you installed ccache, then it will be much faster the second (third, etc.) time you run it.

You are done! Enjoy.

This is a work in progress; for workarounds for some bugs, see BugWorkarounds.


Starting the program

To use the program, first you need to start the scheduler. Go to ~/src/campcaster, and type:

make start

After this, you can start the Studio client by typing

make run

and you can use the Station web interface by opening a web browser and entering the address

http://localhost/~<username>/campcaster/htmlUI/var/html/ui_browser.php

You can check whether the scheduler is running or not by typing

make status


Updating the build from Subversion

Once the development environment is up and running and you want to update your build from Subversion, do the following:

Go to the top Campcaster directory:

cd ~/src/campcaster

Get the new updates to the source code:

svn update

If anything in “src/tools/” has been updated, you need to do this:

make distclean
./bin/setupDevelopmentEnvironment.sh --apache-group=www-data

Otherwise, compile the code:

make recompile

Restart the scheduler:

make stop
make start

After this, you can start the updated Studio client or use the updated Station web interface in the same way as shown above.

Logging Campcaster output from the terminal:

In the standard development environment, the terminal displays a lot of useful information related to Campcaster’s performance. You can write this information to a file by doing the following:

make start &> /path/to/your/log/campcaster.log

or

make start | tee /path/to/your/log/campcaster.log

The difference is that by using tee you can get the output in the log as it is sent; otherwise it will be sent directly to the file and you will get no messages in the terminal.

The same is true for starting Campcaster Studio:

make run &> /path/to/your/log/campcaster-studio.log

or

make run | tee /path/to/your/log/campcaster-studio.log

You can then watch it grow with:

tail -f campcaster.log

Reinitializing the Campcaster database

Type:

make -C src/modules/storageServer db_clean dir_setup db_init