Difference between revisions of "Linux:Installation from sources"

From Wiki for iCub and Friends
Jump to: navigation, search
(Getting all dependencies)
 
(10 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
= Getting all dependencies =
 
= Getting all dependencies =
  
Add www.icub.org to your sources.list. Determine the Linux distribution you use.
+
Add www.icub.org to your sources.list. Below, replace ubuntu with debian, depending on your system.
  
E.g. for Ubuntu 16.04 Xenial (Note: you need to adapt these instructions according to your distribution).
+
  sudo sh -c 'echo "deb http://www.icub.org/ubuntu `lsb_release -cs` contrib/science" > /etc/apt/sources.list.d/icub.list'
 
+
  sudo apt update
  sudo sh -c 'echo "deb http://www.icub.org/ubuntu xenial contrib/science" > /etc/apt/sources.list.d/icub.list'
 
  sudo apt-get update
 
  
 
'''NOTE''' : if apt complains about missing public key, please import the repository public key (this must be done only once) as follows
 
'''NOTE''' : if apt complains about missing public key, please import the repository public key (this must be done only once) as follows
Line 15: Line 13:
 
Install only the package icub-common:
 
Install only the package icub-common:
  
  sudo apt-get install icub-common
+
  sudo apt install icub-common
  
 
If you want to install all packages yourself, this is the list of packages you have to install ([[Linux: dependencies]]).
 
If you want to install all packages yourself, this is the list of packages you have to install ([[Linux: dependencies]]).
Line 23: Line 21:
 
To download sources from our repositories you need to set up a revision control system client. The git client was already installed with the icub-common package.
 
To download sources from our repositories you need to set up a revision control system client. The git client was already installed with the icub-common package.
  
To get sources you don't need to understand git in detail (just follow our instructions). However you can follow this link if you are willing to learn more [[Learning more about git]].
+
To get sources you don't need to understand git in detail (just follow our instructions). However, you can follow this link if you are willing to learn more [[Learning more about git]].
 +
 
 +
= Compile YCM (optional) =
 +
 
 +
Although YCM is already contained in icub-common, you might want to get the latest release. To do so, clone and build the tag associated with the distro at hand as specified in [[Software Versioning Table]].
 +
 
 +
  git clone https://github.com/robotology/ycm.git -b vxx.yy.zz
 +
  cd ycm && mkdir -p build && cd build
 +
  ccmake ../
 +
  sudo make install
  
 
= Compile YARP =
 
= Compile YARP =
  
Follow instructions here: http://www.yarp.it/install_yarp_linux.html, follow the section '''Install from sources -- Compiling YARP''' (you an skip installation of packages).
+
Follow instructions here: http://www.yarp.it/install_yarp_linux.html, follow the section '''Install from sources -- Compiling YARP''' (skip installation of packages).
 +
 
 +
Importantly, for use with the iCub robot when compiling YARP make sure that:
  
Important, for use with the iCub robot when compiling YARP make sure you select the following CMake options:
+
* you check out the correct tag of YARP according to the [[Software Versioning Table]].
 +
* you select the following CMake options:
  
 
   CREATE_OPTIONAL_CARRIERS, set to ON  
 
   CREATE_OPTIONAL_CARRIERS, set to ON  
 
   ENABLE_yarpcar_bayer, set to ON
 
   ENABLE_yarpcar_bayer, set to ON
 +
 +
= Compile iCub =
  
 
== Download iCub source code ==
 
== Download iCub source code ==
In the rest of the tutorial, it will be assume that you will
+
In the rest of the tutorial, it will be assumed that you will
 
downloaded the code in the <tt>/home/user</tt>.
 
downloaded the code in the <tt>/home/user</tt>.
  
Line 44: Line 56:
  
 
This command will create the <tt>/home/user/icub-main</tt> directory, containing  
 
This command will create the <tt>/home/user/icub-main</tt> directory, containing  
the <tt>icub-main</tt> source code.
+
the <tt>icub-main</tt> source code.
 +
 
 +
== Checkout the correct tag ==
 +
Pick up the correct tag vxx.yy.zz from [[Software Versioning Table]] that is compatible with the compiled version of YARP and do:
 +
 
 +
  cd icub-main
 +
  git checkout vxx.yy.zz
  
 
== Create iCub makefiles ==
 
== Create iCub makefiles ==
Line 79: Line 97:
 
= Setup ICUBcontrib (optional) =
 
= Setup ICUBcontrib (optional) =
  
First you need to download the sources.
+
First, you need to download the sources.
  
 
   cd /home/user/
 
   cd /home/user/
 
   git clone https://github.com/robotology/icub-contrib-common.git
 
   git clone https://github.com/robotology/icub-contrib-common.git
  
First set up the ICUBcontrib meta-package, which allows to properly configure your modules/libraries so that they share the same installation prefix.
+
Second, make sure you have the correct release according to [[Software Versioning Table]].
 +
 
 +
  cd /home/user/icub-contrib-common/
 +
  git checkout <tag>
 +
 
 +
Set up the ICUBcontrib meta-package, which allows to properly configure your modules/libraries so that they share the same installation prefix.
  
 
   cd /home/user/icub-contrib-common/
 
   cd /home/user/icub-contrib-common/

Latest revision as of 11:55, 28 February 2020

Linux-all.jpg
The page contains instructions for compiling YARP and the iCub software. We recommend you get the required dependencies from the binary packages.

Getting all dependencies

Add www.icub.org to your sources.list. Below, replace ubuntu with debian, depending on your system.

sudo sh -c 'echo "deb http://www.icub.org/ubuntu `lsb_release -cs` contrib/science" > /etc/apt/sources.list.d/icub.list'
sudo apt update

NOTE : if apt complains about missing public key, please import the repository public key (this must be done only once) as follows

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 57A5ACB6110576A6

Install only the package icub-common:

sudo apt install icub-common

If you want to install all packages yourself, this is the list of packages you have to install (Linux: dependencies).

Setting up revision control systems

To download sources from our repositories you need to set up a revision control system client. The git client was already installed with the icub-common package.

To get sources you don't need to understand git in detail (just follow our instructions). However, you can follow this link if you are willing to learn more Learning more about git.

Compile YCM (optional)

Although YCM is already contained in icub-common, you might want to get the latest release. To do so, clone and build the tag associated with the distro at hand as specified in Software Versioning Table.

 git clone https://github.com/robotology/ycm.git -b vxx.yy.zz
 cd ycm && mkdir -p build && cd build
 ccmake ../
 sudo make install

Compile YARP

Follow instructions here: http://www.yarp.it/install_yarp_linux.html, follow the section Install from sources -- Compiling YARP (skip installation of packages).

Importantly, for use with the iCub robot when compiling YARP make sure that:

 CREATE_OPTIONAL_CARRIERS, set to ON 
 ENABLE_yarpcar_bayer, set to ON

Compile iCub

Download iCub source code

In the rest of the tutorial, it will be assumed that you will downloaded the code in the /home/user.

To download the icub-main source code, just use git:

 cd /home/user
 git clone https://github.com/robotology/icub-main.git

This command will create the /home/user/icub-main directory, containing the icub-main source code.

Checkout the correct tag

Pick up the correct tag vxx.yy.zz from Software Versioning Table that is compatible with the compiled version of YARP and do:

 cd icub-main
 git checkout vxx.yy.zz

Create iCub makefiles

Pick a build directory to store makefiles and binaries, e.g. /home/user/icub-main/build

Run CMake to generate makefiles:

 cd  /home/user/icub-main
 mkdir build
 cd build
 ccmake ../

Hit 'c' to configure the project.

Select options:

 CMAKE_BUILD_TYPE to "Release"
 ENABLE_icubmod_cartesiancontrollerclient ON
 ENABLE_icubmod_cartesiancontrollerserver ON
 ENABLE_icubmod_gazecontrollerclient      ON
 

Leave all other options to default (unless you know what you are doing).

Note 1: You can optionally change CMAKE_INSTALL_PREFIX, this is the directory where you would like to install iCub (default is /usr/local). If you set it to a different prefix than YARP's, you will then need to set up the environment accordingly (see Configure your environment below).

Compile iCub

 cd  /home/user/icub-main/build
 make
 sudo make install

Setup ICUBcontrib (optional)

First, you need to download the sources.

 cd /home/user/
 git clone https://github.com/robotology/icub-contrib-common.git

Second, make sure you have the correct release according to Software Versioning Table.

 cd /home/user/icub-contrib-common/
 git checkout <tag>

Set up the ICUBcontrib meta-package, which allows to properly configure your modules/libraries so that they share the same installation prefix.

 cd /home/user/icub-contrib-common/
 mkdir build && cd build
 ccmake ../

At this stage you must change CMAKE_INSTALL_PREFIX entry here to the path of your liking, preferably in your home; hit 'g' to generate the project. If you do not change the CMAKE_INSTALL_PREFIX you will need to constantly use sudo for any subsequent action, eg: run module with administrative rights.

Finally,

 make install

Once you have installed the ICUBcontrib package you can compile the other modules individually.

Configure your environment

If you installed YARP and/or iCub or ICUBcontrib to non-default directories, you need to set your environment.

  • Set the ICUBcontrib_DIR env var to point to the installation directory.
  • Append $ICUBcontrib_DIR/bin to your PATH.
  • Set the CMAKE_PREFIX_PATH env var to point to the installation directory $ICUBcontrib_DIR.
  • Modify the variable YARP_DATA_DIRS accordingly, i.e.:
 YARP_DATA_DIRS=<YARP_INSTALL_PREFIX>/share/yarp:<ICUB_INSTALL_PREFIX>/share/iCub:<ICUBCONTRIB_INSTALL_PREFIX>/share/ICUBcontrib

Check your installation

Now you are ready to check your installation.