Friday, 23 August 2013

Compile Raspberry Pi Userland / RaspiVid / RaspiStill

I've been working on a few changes to the RaspiVid program which controls the raspberry pi camera board.

The first step was to get the code from github, https://github.com/raspberrypi/userland and compile it.  The raspberry pi camera programs (RaspiVid and RaspiCam) are part of the 'userland' repository and as such I needed to compile the whole repository.

I got most of this information from http://www.darkoperator.com/blog/2013/5/23/fixin-raspistill-and-raspivid-for-headless-streaming-on-the.html.

Install dependencies

sudo apt-get install git-core gcc build-essential cmake vlc

Download code

mkdir ~/code

cd ~/code

git clone git://github.com/raspberrypi/userland.git

Create make files

cd ~/code/userland

sed -i 's/if (DEFINED CMAKE_TOOLCHAIN_FILE)/if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)/g' makefiles/cmake/arm-linux.cmake

Compile

mkdir ~/code/userland/build

cd ~/code/userland/build

sudo cmake -DCMAKE_BUILD_TYPE=Release ..

sudo make

Wait - it will take about 15 minutes to compile the whole of the userland repository.

The executables will be created in the bin directory:

cd ~/code/userland/build/bin

Re-compile
If you change any of the applications, you can re-compile using:

sudo make

It will only compile the changes you have made and will taken significantly less time than the first build.

Install
If you want to install the newly built applications, use:

sudo make install


4 comments:

  1. I am trying to follow your instructions but after 'sudo make' I get:
    make: *** No targets specified and no makefile found. Stop.
    I am very new to the Pi and to compiling on the Pi, and any help is appreciated. Sander.

    ReplyDelete
    Replies
    1. Its been a long time since I compiled userland, so presuming the instructions above still work, it sounds like it cant find a make file, did you do the step:

      sudo cmake -DCMAKE_BUILD_TYPE=Release ..

      Delete
    2. Hi Martin,
      Yes I did. However, I just turned on the Pi to try again, and the command gives a lot more output. Also, the 'sudo make' now seems to work (it is building...). Maybe a reboot was required at some point. Thanks for your help!

      Delete