Table of Contents

Installing YARP on a PC

1) Make sure that the following programs are installed:

sudo apt-get install cmake libace-dev subversion cmake-curses-gui libgtk2.0-dev libgsl0-dev libreadline-dev g++ libncurses5-dev libgtkmm-2.4-dev libglademm-2.4-dev

Recommended: Install OpenCV from sources: OpenCV_Installation

Alternative (NOT recommended): Install precompiled OpenCV packages:

sudo apt-get install libcv-dev libcvaux-dev libopencv-dev

2) Then we obtain YARP from the repositories:

cd ~/local/src
svn co https://yarp0.svn.sourceforge.net/svnroot/yarp0/trunk/yarp2 yarp2

3) Configuring YARP:

cd yarp2
mkdir build && cd build
ccmake -DCMAKE_BUILD_TYPE=Release -DCREATE_SHARED_LIBRARY=ON -DCREATE_DEVICE_LIBRARY_MODULES=ON -DCREATE_GUIS=ON -DCREATE_LIB_MATH=ON -DCREATE_OPTIONAL_CARRIERS=ON -DENABLE_yarpmod_opencv_grabber=ON ..

Hit 'c' to configure. Make sure the following options are set correctly and that there are no dependency problems:

CMAKE_BUILD_TYPE to "Release" 
CREATE_SHARED_LIBRARY, set to ON
CREATE_DEVICE_LIBRARY_MODULES, set to ON
CREATE_GUIS, set to ON
CREATE_GYARPMANAGER, set to ON
CREATE_LIB_MATH, set to ON
CREATE_OPTIONAL_CARRIERS, set to ON
ENABLE_yarpmod_opencv_grabber, set to ON <-- just if we want to use OpenCV features

Hit 'c' again to update and then hit 'g' to generate.

4) Install YARP

make
sudo make install

5) (Additional) Install YARP for Matlab

Make sure yarp2 was compiled with option CREATE_SHARED_LIBRARY set to ON (especially make sure that no old static libraries (*.a) remain in /usr/local/lib)

Java SDK needs to be installed (i.e. Oracle Java)

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Add the following lines to ~/.bashrc (of course you need to change them to your actual paths, if you use matlab 32bit replace “x86_64-linux-gnu” with “i386-linux-gnu”)

export JAVA_HOME=/usr/lib/jvm/java-7-oracle/
export LD_PRELOAD=/lib/x86_64-linux-gnu/libgcc_s.so.1:/usr/lib/x86_64-linux-gnu/libstdc++.so.6

Next install SWIG

sudo apt-get install swig

Go to YARP for Matlab folder and compile the sources

cd ${YARP_ROOT}/bindings
mkdir build && cd build
ccmake -DCREATE_JAVA=ON ..
make

Now we need to compile the Java classes and copy them to a new structure

cd generated_src/
javac -source 1.3 -target 1.3 *.java
mkdir ~/local/src/jyarp
mv LoadYarp.class YarpImageHelper.class ~/local/src/jyarp/
mkdir ~/local/src/jyarp/yarp
mv *.class ~/local/src/jyarp/yarp/
javac -source 1.3 -target 1.3 *.java

Add the following lines to ~/MATLAB/R2012b/toolbox/local/classpath.txt (get your path with 'which classpath.txt' in matlab, specifies location of *.class files)

~/local/src/jyarp
~/local/src/yarp2/bindings/build/generated_src

Find out the location of librarypath.txt ('which librarypath.txt' in Matlab) and set write flags:

chmod +w ~/MATLAB/R2012b/toolbox/local/librarypath.txt

Add the following line to ~/MATLAB/R2012b/toolbox/local/librarypath.txt (location of shared library libjyarp.so)

~/local/src/yarp2/bindings/build

ERRORS during compilation or generation of the makefiles:

* If YARP binaries cannot find OpenCV libraries run the following command to update the library configuration:

sudo ldconfig

*If when configuring yarp with the flag:CREATE_OPTIONAL_CARRIERS set to ON, you get the following error:

CMake Error: File ~/local/src/yarp2/src/carriers/mjpeg_carrier/mjpeg.ini does not exist. CMake Error at conf/YarpPlugin.cmake:477 (CONFIGURE_FILE): configure_file Problem configuring file Call Stack (most recent call first): src/carriers/mjpeg_carrier/CMakeLists.txt:7 (add_carrier_fingerprint)

therefore, comment the line 7 from ~/yarp2/src/carriers/mjpeg_carrier/CMakeLists.txt #add_carrier_fingerprint(mjpeg.ini mjpeg_carrier) and configure again with the same flag on.

Other ERRORS

If you start Matlab from a launcher icon the LD_PRELOAD won't be set correctly, change launcher icon (/usr/share/applications/Matlab.desktop) to

Exec=env "LD_PRELOAD=/lib/x86_64-linux-gnu/libgcc_s.so.1:/usr/lib/x86_64-linux-gnu/libstdc++.so.6" ~/MATLAB/R2012b/bin/matlab -desktop