Hugin Compiling Ubuntu
These instructions are work in progress and updated when newer versions of Ubuntu are released or when Hugin introduces new dependencies. They have worked, at the time of release or soon thereafter, with all versions of Ubuntu/Kubuntu up until 10.4.
They are likely to work only for the latest one, but you can check this page's history at the time that the older Ubuntu version was the most recent one to find the specifics for that version.
Apart from the odd change in package name, nothing should be substantially different (and if does not work, please leave a comment on the hugin-ptx mailing list). Don't worry if the same package appears twice in an apt-get install line - apt-get will update existing packages if there is a newer version, and ignore duplicates if the latest version is already installed. On the other hand, if apt-get says that it can't find a package, it might be the odd change in package name. You can find a replacement package by using apt-cache search with a substring of the package required, e.g.
apt-cache search wxW
The goal is to build hugin and the whole set of helper applications required.
- 1 Building environment
- 2 Building Enblend
- 3 Building Libpano13
- 4 Building Hugin
- 5 Autopano-sift-C
- 6 Match-n-shift
- 7 MatchPoint
- 8 Pan-o-matic
- 9 Exiftool
- 10 Panoglview
- 11 FreePV
- 12 Notes for Packagers
Since we are going to build hugin, libpano13 and enblend we need to download and install all the development packages. This is very easy with apt-get. In a terminal window (K menu -> System -> Konsole or Applications -> Accessories -> Terminal (in Kubuntu), Applications -> Accessories -> Terminal (in Ubuntu))
sudo apt-get install build-essential autoconf automake1.9 libtool flex bison gdb libc6-dev libgcc1
To get the bleeding edge we'll need access to the SVN and Mercurial repositories, and for this we need the correct tools:
sudo apt-get install subversion mercurial
Not necessary, but useful if you want to move to the next level and build packages for distribution (list is incomplete):
sudo apt-get install subversion-tools
To get on the same page as far as file system layout is concerned, we'll create a folder to contain all source code in your home folder:
cd mkdir -p src
Get the dependencies. If you are working with large images (300 megapixels and up), you should have a libtiff-devel compiled with large file support and libstdc++6.
sudo apt-get install pkg-config libtiff4-dev libboost-graph-dev libboost-thread-dev \ liblcms1-dev libglew1.5-dev libplot-dev libglut3-dev libopenexr-dev libxi-dev libxmu-dev \ help2man texi2html texinfo fig2ps tidy gnuplot libxml-xpath-perl
For Ubuntu systems prior to 8.10, you will also need
sudo apt-get install libopenexr2ldbl
Once all dependencies are in place, get the code. The official repository has migrated from CVS to Mercurial:
mkdir -p ~/src/enblend cd ~/src/enblend hg clone http://enblend.hg.sourceforge.net:8000/hgroot/enblend/enblend enblend.hg cd enblend.hg
If you already have checked out enblend, to update the code to the latest version you need to run:
hg pull hg update
Then create a build directory and build in there. And install the Package
cd .. mkdir enblend.build cd enblend.build cmake ../enblend.hg -DCPACK_BINARY_DEB:BOOL=ON -DENABLE_GPU:BOOL=ON -DENABLE_IMAGECACHE:BOOL=OFF -DENABLE_OPENMP:BOOL=ON make package sudo dpkg -i enblend-4.1.1-Linux.deb
The above options are good for modern multi-core computers. For a single core, you may be better off setting ENABLE_OPENMP to OFF and ENABLE_IMAGECACHE to ON. The two options are mutually exclusive.
The old autotools way
We are then ready to compile. The CXXFLAGS --param inline-unit-growth=60 is a workaround for x86_64 systems, Feb 2009, and apparently no longer needed (set by default). If you have an SMP machine and you're building a recent version, --disable-image-cache and --enable-openmp will speed up enblend/enfuse massively but may cause segmentation faults; in that case you will be better off with --enable-image-cache and --disable-openmp. -march=native is also beneficial and -O2 is better than -O3.
make --makefile=Makefile.scm mkdir BUILD cd BUILD CXXFLAGS="--param inline-unit-growth=60 -march=native -O2" ../configure --disable-image-cache --enable-openmp make
The second make step can be very long and memory consuming. Make sure you have enough swap space, and go get a healthy snack while the computer is compiling.
If you encounter problems at any of these stages, please report back to the hugin-ptx mailing list. Report what command in the sequence you were executing, what machine/operating system, the revision checked out from CVS, and all other relevant information.
You are then ready to install with
sudo make install
libpano13 is the new version of the PanoTools libraries. This is a necessary component for hugin, and we need to build it first.
To build libpano13 we need some libraries and particularly their
sudo apt-get install zlib1g zlib1g-dev libpng12-dev libjpeg62-dev libtiff4-dev cmake
On older distributions, zlib1g and zlib1g-dev may not be found. In that case, the same library may be available with the names lib64z1 and lib64z1-dev.
We then need to download the source code from SVN:
mkdir -p ~/src/libpano cd ~/src/libpano svn co https://panotools.svn.sourceforge.net/svnroot/panotools/trunk/libpano libpano13.svn cd libpano13.svn
In the future there is no need to get the whole source again. Just issue the following commands to bring your source up to date:
cd ~/src/libpano/libpano13.svn svn up
Now start the building process.
cd .. mkdir build.libpano cd build.libpano cmake ../libpano13.svn -DCMAKE_INSTALL_PREFIX=/usr/local -DCPACK_BINARY_DEB:BOOL=ON -DCPACK_BINARY_NSIS:BOOL=OFF \ -DCPACK_BINARY_RPM:BOOL=OFF -DCPACK_BINARY_STGZ:BOOL=OFF -DCPACK_BINARY_TBZ2:BOOL=OFF \ -DCPACK_BINARY_TGZ:BOOL=OFF -DCPACK_BINARY_TZ:BOOL=OFF make package sudo dpkg -i libpano13-*-Linux.deb
The above described building process uses CMake to build libpano which has many advantages. Amongst others it creates a clean package to install / deinstall and decreases the likelihood of wrecking the system. However CMake support is relatively new in libpano. The old autotools way is documented below for completness. You should not need it. However if you do, make sure to run either the CMake build or the autotools build on fresh SVN checkouts to avoid interferences.
If any libraries are missing, the script will complain (or at least, let you know that some library hasn't been found). In that case you probably need to install the library. To find in what package is that library, a general rule is to run the command
apt-cache search missingfile, find the relevant library and install both the library and the related
./configure script and repeat this process until you have met all the dependencies.
Then we are ready to launch the make process with
If the library successfully compiles, you have to install it with
sudo make install sudo ldconfig
The last part is for the OS to be aware of the new library (that has been installed in
We can now go back up one folder level and get ready for hugin.
First we need to activate the
universe repository (in adept package manager, or by editing the /etc/apt/sources.lst file for example) and get the dependencies:
sudo apt-get install cmake libopenexr-dev libboost-dev boost-build libboost-thread-dev libboost-graph-dev \ gettext libwxgtk2.8-dev libexiv2-dev libimage-exiftool-perl libglew-dev liblapack-dev
Fetch the Source Code with Mercurial
In May 2010 the Hugin project migrated from Subversion (SVN) to Mercurial (hg). SVN-related instructions are generally outdated.
First we clone the repository. Unlike SVN, we do not need to choose at this moment which version of Hugin to download/build yet.
If you already have a repository clone, you only need to pull the latest changes and update the code with:
cd ~/src/hugin/hugin.hg hg pull hg update
Else, you need to clone the repository and decide which version/branch to build with:
mkdir -p ~/src/hugin cd ~/src/hugin hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin hugin.hg cd hugin.hg hg branches
The `hg branches` command will list all available branches. If you decide, e.g., to build the 2010.0 branch, you will update to it with:
hg update -C 2010.0
Advanced Use - Multiple Source Trees: You may want to build multiple versions of Hugin on your machine at the same time, e.g. when you want to build side by side a stable version for your productivity and a development version to give feedback to the developers. In that case, you will clone the Mercurial repository that is already on your drive and update from it a source tree to a different branch. Mercurial takes care of details such as optimizing disk usage. The commands for this are:
cd .. hg clone hugin.hg another_hugin > cd another_hugin > hg update -C default
You can have as many "another_hugin" folders as you want. Just make sure, when pulling the latest updates from SourceForge, to first pull your main repository (the one you cloned from http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin. Then pull all others:
cd ~/src/hugin/hugin.hg hg pull hg update cd ../another_hugin hg pull hg update
Configure the Build Environment
Rule: You always want to build outside of the source tree to keep the source tree clean. And to avoid confusion, if you have multiple source trees it is preferable to build for each of them in a separate build folder.
Next we set up the build environment using cmake.
If you compiled and installed libpano to a non standard location set the variables CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH to point to your install location's include and lib directories.
If you are building for distribution, you want to set CMAKE_INSTALL_PREFIX=/usr
cd ~/src/hugin mkdir hugin.hg-build cd hugin.hg-build cmake ../hugin.hg -DENABLE_LAPACK=YES -DCPACK_BINARY_DEB:BOOL=ON -DCPACK_BINARY_NSIS:BOOL=OFF \ -DCPACK_BINARY_RPM:BOOL=OFF -DCPACK_BINARY_STGZ:BOOL=OFF -DCPACK_BINARY_TBZ2:BOOL=OFF \ -DCPACK_BINARY_TGZ:BOOL=OFF -DCPACK_BINARY_TZ:BOOL=OFF
Build and Install
Finally, we use make to build the code and package it, and dpkg to install it. Look for the version number in the .deb file created and edit the lines below accordingly:
make package sudo dpkg -i hugin-*-Linux.deb sudo ldconfig
Important: the package does not track dependencies yet, so it likely to fail on machines others than yours.
sudo apt-get install libxml2-dev
(Note January 2010 / May 2010: Currently the autopano-sift-C SVN trunk, as well as Hg default tip, is unstable, use the 2.5.1 release tarball instead)
mkdir -p ~/src/apsc cd ~/src/apsc hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/autopano-sift-C apsc.hg cd apsc.hg hg branches hg update -C 2.5.1 cd .. mkdir apsc.hg.build cd apsc.hg.build cmake ../apsc.hg -DCMAKE_INSTALL_PREFIX=/usr/local -DCPACK_BINARY_DEB:BOOL=ON -DCPACK_BINARY_NSIS:BOOL=OFF \ -DCPACK_BINARY_RPM:BOOL=OFF -DCPACK_BINARY_STGZ:BOOL=OFF -DCPACK_BINARY_TBZ2:BOOL=OFF \ -DCPACK_BINARY_TGZ:BOOL=OFF -DCPACK_BINARY_TZ:BOOL=OFF make package sudo dpkg -i autopano-sift-C-*-Linux.deb
Match-n-shift is yet an other Autopano-SIFT replacement. It comes in a bundle with pto file manipulation perl libraries and a rich selection of other tools that use nona, enblend, ImageMagick among other things. To use match-n-shift, you need to install at least the Panotools::Script library and some other perl modules. It requires:
- Image::Size 2.9
- Storable 2.0
- Image::ExifTool 6
Chances are that you do not need to update Storable which is a standard perl module. To check the version of installed versions of these modules, write these lines to the command prompt:
perl -MStorable -le 'print Storable->VERSION;' perl -MImage::Size -le 'print Image::Size->VERSION;' perl -MImage::ExifTool -le 'print Image::ExifTool->VERSION;'
There are various ways to install or upgrade these modules. Ubuntu has binary packages for many perl modules, you can skip the CPAN installation below and type:
sudo apt-get install libimage-size-perl libimage-exiftool-perl
Alternatively, perl is an interpreted language and these modules are pure perl, so installing from source is an easy thing.
The best place to install perl modules is directly from a CPAN archive. CPAN is short for Comprehensive Perl Archive Network. The program to interact with CPAN comes with all perl installations. Start it by running:
If this is your first time running the program you will be asked a number of questions (you can safely accept the suggested values). Last question lets you select a number of CPAN mirrors nearest to you.
When all is done, you can enter the install commands after the 'cpan>' prompt:
install Image::Size Storable Image::ExifTool
Answer 'y' to any question of dependencies and wait for install to complete. 'exit' leaves the cpan shell.
Next, you need to retrieve and install the Panotools-Script collection of perl libraries (Panotools::Script) and programs that use them - including match-n-shift:
svn co https://panotools.svn.sourceforge.net/svnroot/panotools/trunk/Panotools-Script Panotools-Script cd Panotools-Script perl Makefile.PL make make test sudo make install
Just to confuse you, you can also ignore everything above and just install Panotools::Script and all its dependencies from CPAN. From command line, type:
sudo cpan Panotools::Script
You can run match-n-shift from command line using the same parameters as autopano-c-complete.sh or you can modify hugin to run it for you:
- start Hugin
- navigate the menu File to Preferences
- In the Preferences window, open the Autopano tab
- Select Autopano -> Autopano-SIFT
- tick the checkbox for Use alternative Autopano-SIFT program
- enter the full path to match-n-shift (/usr/local/bin/match-n-shift) in the Autopano-SIFT field
- enter the following string in the Arguments field:
-f %f -v %v -c -p %p -o %o %i
MatchPoint is a next generation CP generator. The result of a GSoC2007 project, it is still very experimental. Experience reports needed. Read more here
Matchpoint is now located inside the main hugin source tree, no need to checkout separately. It is compiled together with hugin, but not installed by default.
- copy the MatchPoint executable into /usr/local/bin manually
sudo cp src/matchpoint/matchpoint /usr/local/bin/
- edit /usr/local/bin/autopano-c-complete.sh (do it with sudo to have the necessary permission)
- line 79: replace the .key.gz extension with .key (not sure if matchpoint supports compression)
- lines 83 and 88: replace generatekeys "$arg" $FILENAME $SIZE with matchpoint "$arg" $FILENAME (not sure if the size option or any other options of the original generatekeys are applicable)
Yet another control point generator Home Page
sudo apt-get install libboost-dev
tar xvfj panomatic-0.9.4-src.tar.bz2 cd panomatic-0.9.4 patch -p 1 < ../panomatic_gcc44.patch ./configure make sudo make install
To use Pano-o-matic, open Hugin
- In File > Preferences > Autopano :
- Select Autopano-SIFT
- Check "Use alternative autopaon-SIFT program"
- Choose the path to the binary ( /usr/local/bin )
- In Arguments, put : -o %o %i
Around the end of the year 2009, Pablo integrated a new experimental descriptor based on the geometric blur and DAISY papers. Also, Pablo said that the algorithm is not really based on a published approach, just on some ideas that are mentioned in a few of them, and its currently simpler than any of them:
o geometric blur: 
o daisy: 
o descriptor learning: 
To build that version of panomatic instead, follow these instructions:
This is current the subject of a GSoC 2010 project and may be available in future versions of Hugin.
sudo aptitude install libboost-python-dev bzr cmake libvigraimpex-dev
bzr branch lp:~pablo.dangelo/hugin/panomatic-lib mkdir build cd build cmake ../panomatic-lib make sudo make install
To use the new descriptor the arguments for Hugin are: --grad --sieve1size 100 --sieve2size 2 -o %o %i
ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta information in image, audio and video files.
sudo apt-get purge libimage-exiftool-perl
wget http://www.sno.phy.queensu.ca/~phil/exiftool/Image-ExifTool-7.94.tar.gz tar -xzf Image-ExifTool-7.94.tar.gz cd Image-ExifTool-7.94 perl Makefile.PL make test sudo make install
PanoGLView is an OpenGL hardware accelerated interactive immersive viewer for equirectangular images.
sudo apt-get install wx-common
To build and install:
mkdir -p ~/src/panoglview cd ~/src/panoglview hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/panoglview pglv.hg cd pglv.hg hg update ./bootstrap ./configure make sudo make install
sudo apt-get install cmake make pkg-config g++ mozilla-dev freeglut-dev zlib1g-dev libjpeg-dev libxext-dev libxmu-dev \ x11proto-xf86vidmode-dev libxxf86vm-dev libnspr4-dev libxml2-dev libpng12-dev
svn co https://freepv.svn.sourceforge.net/svnroot/freepv/freepv/trunk/ freepv cd freepv cmake . make sudo make install
Notes for Packagers
- Outdated - need something equivalent with Hg: before releasing a tarball, upgrade the Changelog with svn2cl
$ svn up $ svn2cl $ svn ci