CompileLinux

From Wiki for RobotCub and Friends

Jump to: navigation, search

Important: we assume here that you have completed the previous steps in the manual (see Section 6.1 "Prepare Your System" in the manual's main page).

Before you compile the code you need to generate make files.

Here we assume you have completed the previous steps (preparing your system, getting the software, setting up your environment).

Contents

Compiling YARP

Create the YARP Makefiles

Run (don't forget to set the environment variables first):

 cd $YARP_ROOT
 ccmake ./

Choose the following options:

  • CMAKE_BUILD_TYPE, set to "Release" in case you'd like to optimize
  • CREATE_GUIS, set to ON
  • CREATE_LIB_MATH, set to ON

Important: CREATE_GUIS and CREATE_LIB_MATH require you have installed the libraries gtk and gsl (see PrepareLinux)

Create the makefiles by selecting configure several times and then generate.

Installation: CMake automatically creates an install rule for target/project. In the documentation we assume you install binaries in $YARP_ROOT/bin and $YARP_ROOT/lib. The compiler will build executables and libraries there, so you don't need to perform the installation. You can instruct CMake so that it generates make/project files that install to other places, for example $YARP_DIR/bin and $YARP_DIR/lib. You can do this by running cmake again and setting the variable:

  • CMAKE_INSTALL_PREFIX to $YARP_DIR

When you do make install all binaries will be copied to $YARP_DIR/bin and $YARP_DIR/lib.

Of course you can customize the installation directory as you wish, however the remainder of the documentation assumes the above configuration.

  • Depending on the hardware on your system you might want to compile additional device drivers. This is done for example on the pc104. Instruction for doing this are reported elsewhere.

Compile

Now we are ready to compile. This is easy.

Run:

 cd $YARP_ROOT
 make

Example -- is YARP available?

Now we're ready to run a simple Yarp code to test the installation so far. You might want to prepare a yarp.conf file in the conf directory similar to this one:

127.0.0.1 10000

which tells Yarp (the server) to start on the localhost and respond to port 10000. This allows Yarp applications to find the name server (see next chapter).

You can then try running the server. On a terminal window, type:

yarpserver &

and you should see:

yarp: Port /root active at tcp://127.0.0.1:10000 Name server can be browsed at http://127.0.0.1:10000/ yarp: Bootstrap server listening at mcast://224.2.1.1:10001

if you type on a web browser http://127.0.0.1:10000 you get information about the name server (registered ports, info, etc.).

For the time being we can just check functionality by running a simple example. On another terminal type:

yarp read /portread

on a third terminal:

yarp write /portwrite

and on yet another terminal:

yarp connect /portwrite /portread

you'll see the effect on the name server:

yarp: registration name /portwrite ip 127.0.0.1 port 10012 type tcp
yarp: registration name /portread ip 127.0.0.1 port 10002 type tcp

Now, anything typed on the yarp write will be sent and printed on the read side.

Compile the iCub software

Generate makefiles

First you need to generate make files. In $ICUB_ROOT:

ccmake ./

You don't need particular options. If you want to compile using optimization just set:

  • CMAKE_BUILD_TYPE to "Release"

Other options are:

  • CREATE_GUIS_GTK
  • CREATE_GUIS_GTKMM
  • CREATE_GUIS_QT

These options are recommended, because they enable compilation of some useful GUIs. Important: these options can be enabled only if you have installed the required libraries: gtk, gtkmm and qt (see PrepareLinux).

  • Similarly to YARP, by default make will build executables and libraries in $ICUB_ROOT/bin and $ICUB_ROOT/lib. You can customize where "make install" will copy these files by setting: CMAKE_INSTALL_PREFIX to something you like.

If you need to compile devices that provide interface to the hardware you can follow this link Compilation on the pc104

Compile

Compile the code.

 cd $ICUB_ROOT
 make
Personal tools