Compile linux old
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).
Create the YARP Makefiles
Run (don't forget to set the environment variables first):
mkdir $YARP_DIR cd $YARP_DIR ccmake $YARP_ROOT
It is usually a good idea to set YARP_DIR=$YARP_ROOT/build or something like that.
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 have binaries in $YARP_DIR/bin and $YARP_DIR/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. You can do this by running cmake again and setting the variable:
When you do make install all binaries will be copied to CMAKE_INSTALL_PREFIX/bin and CMAKE_INSTALL_PREFIX/lib.
For other packages to use YARP you need to set YARP_DIR so that it points to CMAKE_INSTALL_PREFIX (although this might not be required if CMAKE_INSTALL_PREFIX is one of the system paths).
Of course you can customize the installation directory as you wish, however the remainder of the documentation assumes the above configuration.
Important for installation: if you decide to install YARP in non system directories you need to take extra care so that libraries will be found correctly. See: Avoid LD_LIBRARY_PATH.
- 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.
Now we are ready to compile. This is easy.
cd $YARP_DIR 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:
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:
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://126.96.36.199: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
Important: since July 2010 we have a new build system, and organization of the repository has changed. This page contains the instructions for compiling the old repository: CompileLinux(Old).
You first need to generate make files.
mkdir $ICUB_DIR cd $ICUB_DIR ccmake $ICUB_ROOT/main
CMake is an iterative process, hit c until the option "generate" appears then hit g and exit.
makefiles will be placed in $ICUB_DIR. At any time you can remove the content of $ICUB_DIR to generate new makefiles.
An important option is to enable optimization just set:
- CMAKE_BUILD_TYPE to "Release"
CMake will check all dependencies, for each <package> it creates a variable called ICUB_HAS_<package>. This is true or false if the library has been found or not.
In addition for each <package> there is a variable called ICUB_USE_<package>; this tells cmake if you want to ignore a particular package. CMake will compile only modules that meet the enabled dependencies.
See PrepareLinux for instructions about how to prepare your system so that all dependencies are satisfied.
This determines where the compiler will install the applications, by default this is initialized to $ICUB_ROOT.
- Similarly to YARP, by default make will build executables and libraries in $ICUB_DIR/bin and $ICUB_DIR/lib. If you prefer to install the software you might want to customize where "make install" will copy these files by setting: CMAKE_INSTALL_PREFIX to something you like.
Important for installation: if you decide to install iCub in non system directories you need to take extra care so that libraries will be found correctly. See: Avoid LD_LIBRARY_PATH.
If you need to compile devices that provide interface to the hardware you can follow this link Compilation on the pc104
Compile the code.
cd $ICUB_DIR make
Don't forget to install applications.
this will copy a set of config and xml template files to ICUB_APPLICATIONS_PREFIX/app.