Difference between revisions of "HomebrewNew"

From Wiki for iCub and Friends
Jump to navigation Jump to search
(Created page with "Installation of YARP and iCub software on Mac OS X is straightforward, using the Homebrew package manager. Latest update and testing: 2/8/2013 - using OS X 10.8.4 and Xcode 4...")
(Blanked the page)
Line 1: Line 1:
Installation of YARP and iCub software on Mac OS X is straightforward, using the Homebrew package manager.

Latest update and testing: 2/8/2013 - using OS X 10.8.4 and Xcode 4.6.3
= Installing Xcode =
To compile anything on OS X (including YARP), you'll need to have XCode ([http://developer.apple.com/xcode/ http://developer.apple.com/xcode/]) installed. This can be done through the App Store.
Once installed, you need to install Command Line Tools. To do this, open XCode, go to XCode->Preferences->Downloads and install Command Line Tools. You can now install Homebrew.
= Installing X11 =
In OS X 10.8 Mountain Lion, X11 is not provided anymore. You need to install XQuartz, from [http://xquartz.macosforge.org/landing/ http://xquartz.macosforge.org/landing/].
In earlier version of OS X, this is not stricly necessary, but recommended as XQuartz is more robust and updated that the system-provided X11.
= Installing Homebrew =
Installing homebrew ([http://mxcl.github.com/homebrew/ http://mxcl.github.com/homebrew/]) is very simple, just follow the [https://github.com/mxcl/homebrew/wiki/installation official installation steps].
After the installation, you can run the following command to check if your setup is good :
  brew doctor
If you had Homebrew already installed on your system, update and upgrade :
  brew update
  brew upgrade
= Installing Yarp =
== Full Homebrew setup ==
This option is recommended for standard users. If homebrew installation was successful, then installing YARP (with all dependencies) is just a matter of executing:
  brew install yarp
If you need the latest svn revision of YARP instead of the provided release, edit the file /usr/local/Library/Formula/yarp.rb and replace  the line :
  head 'https://yarp0.svn.sourceforge.net/svnroot/yarp0/trunk/yarp2'
with :
  head 'https://github.com/robotology/yarp/trunk'
if this fails try the following:
  head 'https://github.com/robotology/yarp.git'
Save the edited file and run the command :
  brew install --force --HEAD yarp
If these installation were successful you can directly [[check your installation | check your yarp installation]].
If any problem arise you can't solve, feel free to contact the RobotCub mailing list (<robotcub-hackers@lists.sourceforge.net>).
== Alternative : Only installing Yarp dependencies using Homebrew ==
If you want to install YARP yourself from source, you can install YARP depedencies for homebrew with the following command :
brew install `brew deps --1 yarp | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g'`
Before installing YARP, follow the next section, "Setting up pkg-config".
You can then follow the [[Linux:Installation from sources#Getting the YARP and iCub sources|Linux YARP compile instructions]].
= Setting up pkg-config =
In order to install YARP (from source) or iCub correctly, the following command needs to run without problems :
pkg-config --cflags gtk+-2.0
This should not be yet the case. You need to modify your PKG_CONFIG_PATH, since it does not yet include files such as freetype2.pc.
In OS X 10.8 (Mountain Lion), run this in a terminal:
echo "export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig/:$PKG_CONFIG_PATH" >> ~/.bash_profile
source ~/.bash_profile
For OS X 10.7 and older:
If you installed XQuartz, run this in a terminal :
echo "export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig/:$PKG_CONFIG_PATH" >> ~/.bash_profile
source ~/.bash_profile
Else, run this :
echo "export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig/:$PKG_CONFIG_PATH" >> ~/.bash_profile
source ~/.bash_profile
Then check again if the command run properly.
pkg-config --cflags gtk+-2.0
This should produce something of the sort :
-D_REENTRANT -I/usr/X11/include/cairo -I/usr/X11/include/pixman-1 -I/usr/X11/include -I/usr/X11/include/freetype2
-I/usr/X11/include/libpng15 -I/usr/local/Cellar/gtk+/2.24.11/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.11/lib/gtk-2.0/include
-I/usr/local/Cellar/atk/2.4.0/include/atk-1.0 -I/usr/local/Cellar/gdk-pixbuf/2.26.1/include/gdk-pixbuf-2.0
-I/usr/local/Cellar/pango/1.30.1/include/pango-1.0 -I/usr/local/Cellar/glib/2.32.4/include/glib-2.0
-I/usr/local/Cellar/glib/2.32.4/lib/glib-2.0/include -I/usr/local/Cellar/gettext/
If this is not the case (and it throws something about freetype2.pc or cairo.pc missing), it may be because you did not setup your PKG_CONFIG_PATH correctly.
= Installing iCub =
At the moment of writing this manual there is not yet an homebrew installation for the iCub repository. Nevertheless installation is simple since all dependencies can be installed with homebrew.
== Installing iCub dependencies with homebrew ==
First, install the iCub dependencies with homebrew.
brew install sdl sdl_gfx sdl_image gfortran
=== ODE ===
Please note that installing ode with homebrew might result in a single-precision build, whereas you might prefer a double precision build. In order to enable a double precision build, run :
brew install ode --enable-double-precision
=== OPENCV ===
OpenCV has been moved to homebrew/science. In order to install it please run the following command: (Thanks to Konstantinos Theofilis for noting this)
brew tap homebrew/science
brew install opencv
=== QT4 ===
The QT4 libraries needs to be installed with the QT3-support option, which is enabled as follows:
brew install --with-qt3support qt
===Post-install fixes===
If you want to compile any projects that include OpenCV libraries, you should create an empty directory:
mkdir -p /usr/local/share/OpenCV/3rdparty
Also, to compile IPOPT-related modules, the following symbolic links have to be created (assuming your current gfortran version is 4.8.1):
ln -s /usr/local/Cellar/gfortran/4.8.1/gfortran/lib/libgfortran.a /usr/local/lib/libgfortran.a
ln -s /usr/local/Cellar/gfortran/4.8.1/gfortran/lib/libgcc_ext.10.5.dylib /usr/local/lib/libgcc_ext.10.5.dylib
ln -s /usr/local/Cellar/gfortran/4.8.1/gfortran/lib/libquadmath.a /usr/local/lib/libquadmath.a
== Installing Ipopt ==
These instructions were tested on OS X Lion and Mountain Lion, and adapted from [[Installing IPOPT]].
=== HSL MA27 and MC19 routines ===
Ipopt is available from homebrew, but we need finer control on the configuration of the installation. We install it manually. This assumes you want to use the iKin (cartesian interface) and the HSL library, which requires proprietary code. MUMPS provides the same functionality and is open-source, but it was not tested (you may want to follow [[Installing IPOPT]] if you're interested by MUMPS, and edit this doc if you make it work).
You will need to get the HSL MA27 and MC19 routines, and put the code if files name respectively ma27ad.f and mc19ad.f. These routines are '''mandatory''', i.e. without them you will be able to compile IpOpt (since it employs a runtime Linear Solver Loader) but it will not work. In the current documentation, we do not discuss the use of MA57+METIS, i.e. the successor of MA27 (if you do make it work, edit this page). The routines are available here :
* [http://www.hsl.rl.ac.uk/download/MA27/1.0.0/a/ http://www.hsl.rl.ac.uk/download/MA27/1.0.0/a/]
* [http://www.hsl.rl.ac.uk/download/MC19/1.0.0/a/ http://www.hsl.rl.ac.uk/download/MC19/1.0.0/a/]
=== Compilation ===
Download Ipopt [http://www.coin-or.org/download/source/Ipopt IpOpt source code] and put it wherever you like; call this location IPOPT_DWN_DIR
Download the third-party code Blas, Lapack.
cd $IPOPT_DWN_DIR/ThirdParty
cd Blas; ./get.Blas; cd ..
cd Lapack; ./get.Lapack; cd ..
Copy the MA27 and MC19 routines (ma27ad.f and mc19ad.f files) in the IPOPT_DWN_DIR/ThirdParty/HSL dir.
Run configure script. We install in /usr/local. This will make brew doctor angsty, but this is by far the simplest way.
./configure --with-blas=BUILD --with-lapack=BUILD --with-hsl=BUILD --prefix=/usr/local
make test
All tests should pass.
sudo make install
=== Testing ===
TODO: write testing section
== Installing iCub from sources in svn ==
Once dependencies have been installed you need to retrieve the iCub source code. Just execute the following commands (choosing your preferred directory where to put the source files):
  mkdir myPrefCodeDir
  cd myPrefCodeDir
  svn co https://svn.code.sf.net/p/robotcub/code/trunk/iCub
After executing the command above, you need to compile the iCub repository as described in the [[Linux:Installation from sources#Compile iCub| linux iCub compile instructions]] considering that if you followed the instructions above, then ICUB_REPOSITORY=myPrefCodeDir/iCub.
= Check your installation =
Now you are ready to [[check your installation]].
= Additional Useful Information =
Here are some useful information, mainly for problematic installations.
== Do I need all these dependencies? ==
Depending on what iCub software you are planning to use, you do not require all the dependencies. In the following a list of the dependencies according to what you are planning to do with the iCub.
The iCub simulator for example requires:
  brew install ode
  brew install sdl sdl_gfx sdl_image
The visual processing modules (e.g. stereoCalib, motionCut) require:
  brew install opencv
The graphical user interfaces (e.g. robotMotorGui) require:
  brew install gtk+
  brew install gtkmm
  brew install cairo
The inverse kinematic modules (e.g. iKin) require:
  brew install gfortran
  brew install ipopt
== Generating a Xcode project ==
If you installed Yarp and iCub with source from svn, you can also compile them from an Xcode project which can be created by simply executing:
cmake . -G Xcode
== Possible conflicting libraries ==
It may also be necessary to move any "fink"/"macport" libraries out of the way, if you have used those package managers in the past.  For example, if you have a "/sw" directory, consider moving it. In any case, you should not mix Homebrew with Macport or Fink.
= Python Bindings =
To use the python bindings for YARP, you have to install swig first:
  brew install swig
Also, YARP must be compiled with the CREATE_SHARED_LIBRARY and INSTALL_WITH_RPATH options ON.
==Building the bindings==
Go to $YARP_ROOT/bindings and create a build directory:
  cd $YARP_ROOT/bindings
  mkdir build
  cd build
Then run cmake:
  ccmake ..
and set CREATE_PYTHON to ON.
If you don't use Apple's built-in Python, you also have to set your Python's include directory and library. Toggle CMake's advanced mode by pressing t. Then find and change accordingly the following two fields:
==Create the documentation==
In the build directory above, start a python interpreter:
and then:
  >>> import pydoc
  >>> pydoc.writedoc('yarp')
It will produce a yarp.html file

Latest revision as of 20:27, 9 September 2013