Difference between revisions of "Hugin Compiling Ubuntu"

From PanoTools.org Wiki
Jump to: navigation, search
(Building Enblend)
Line 49: Line 49:
cvs -z3 -d:pserver:anonymous@enblend.cvs.sourceforge.net:/cvsroot/enblend co -P enblend
cvs -z3 -d:pserver:anonymous@enblend.cvs.sourceforge.net:/cvsroot/enblend co -P enblend
cd enblend</pre>
cd enblend</pre>
We are then ready to compile.
We are then ready to compile (the CXXFLAGS bit is a workaround for x86_64 systems, Feb 2009).
<pre>make -f Makefile.cvs
<pre>make -f Makefile.cvs
CXXFLAGS="--param inline-unit-growth=60" ./configure

Revision as of 12:50, 11 February 2009

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 the following Ubuntu/Kubuntu versions:

  • Ubuntu 8.10: on AMD64 computer
  • Ubuntu 8.04: on an Intel processor
  • Ubuntu 7.10: on AMD Athlon XP
  • Ubuntu 7.04: on AMD64 computer
  • Ubuntu 6.06: on AMD64 computer

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.

Building environment

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

Unless you have an amd64 system prior to 7.10, add the following packages.

sudo apt-get install libc6-dev libgcc1

For older amd64 environments, the packages have a slightly different name:

sudo apt-get install libc6-dev-amd64 lib64gcc1

To get the bleeding edge we'll need access to the SVN and CVS repositories, and for this we need the correct tools:

 sudo apt-get install subversion cvs

Building Enblend

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 libglew-dev libplot-dev libglut3-dev libopenexr-dev libxi-dev libxmu-dev

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 from CVS (simply press ENTER when prompted for a password on the login command) and build it.

cvs -d:pserver:anonymous@enblend.cvs.sourceforge.net:/cvsroot/enblend login
cvs -z3 -d:pserver:anonymous@enblend.cvs.sourceforge.net:/cvsroot/enblend co -P enblend
cd enblend

We are then ready to compile (the CXXFLAGS bit is a workaround for x86_64 systems, Feb 2009).

make -f Makefile.cvs
CXXFLAGS="--param inline-unit-growth=60" ./configure

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

Building Libpano13

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 dev package:

sudo apt-get install zlib1g zlib1g-dev libpng12-dev libjpeg62-dev libtiff4-dev

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:

svn co https://panotools.svn.sourceforge.net/svnroot/panotools/trunk/libpano libpano13
cd libpano13

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 -dev package. Run the ./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 /usr/local/lib). We can now go back up one folder level and get ready for hugin.

cd ..

Building Hugin

Some additional libraries are needed. We need first to activate the universe repository (in adept package manager, or by editing the /etc/apt/sources.lst file for example). Also, since SVN revision 3479 (8-Oct-2008) a new dependency has been added to libglew.

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.

We download the source from SVN, as before

svn co https://hugin.svn.sourceforge.net/svnroot/hugin/hugin/trunk/ hugin
cd hugin

Important: at the time of writing hugin is under development. The SVN trunk is likely to change often and can sometimes have critical bugs. Try the above first. If it does not work, please report back to the hugin-ptx mailing list. If you need a recent working version of hugin, find out from the mailing list what is the latest working revision number and plug it in after the -r switch in

svn co -r 2906 https://hugin.svn.sourceforge.net/svnroot/hugin/hugin/trunk/ hugin
cd hugin

hugin has to be built using cmake (which we installed before).

cmake -DCMAKE_INSTALL_PREFIX=/usr/local .

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.

Finally, launch the compilation and installation with

sudo make install
sudo ldconfig

Reference: [1]


sudo apt-get install libxml2-dev
svn co https://hugin.svn.sourceforge.net/svnroot/hugin/autopano-sift-C/trunk/ autopano-sift-C
cd autopano-sift-C
cmake -DCMAKE_INSTALL_PREFIX=/usr/local .
sudo make install


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:

  • Math::Matrix 0.4
  • Image::Size 2.9
  • Storable 2.0

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 -MMath::Matrix -le 'print Math::Matrix->VERSION;'
 perl -MImage::Size -le 'print Image::Size->VERSION;'

There are various ways to install or upgrade these modules. Ubuntu has binary packages for many perl modules but unfortunately not for Math::Matrix. Perl is 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:

 sudo cpan

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 Math::Matrix Image::Size Storable

Answer 'y' to any question of dependencies and wait for install to complete. 'exit' leaves the cpan shell.

If you rather use Ubuntu packages to install as much as you can, you can skip the Image::Size installation above and type:

 sudo apt-get install libimage-size-perl

Lastly, you can download Math::Matrix tar ball from CPAN: http://search.cpan.org/~ulpfr/Math-Matrix-0.5/ and follow the installation instructions in the tar ball file.

Next, you need to retrive 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 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 https://hugin.svn.sourceforge.net/svnroot/hugin/gsoc07_featuredetection anymore. 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

Download Panomatic 0.9.4 bz2

tar xvfj panomatic-0.9.4-src.tar.bz2
cd panomatic-0.9.4
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


To get the bleeding edge

sudo apt-get remove libimage-exiftool-perl
wget http://www.sno.phy.queensu.ca/~phil/exiftool/Image-ExifTool-7.65.tar.gz
tar -xzf Image-ExifTool-7.65.tar.gz
cd Image-ExifTool-7.65
perl Makefile.PL
make test
sudo make install


panoglview is a program that allows you to view an equirectangular image interactively. You have to install

sudo apt-get install wx-common

To build

svn co https://hugin.svn.sourceforge.net/svnroot/hugin/panoglview/trunk panoglview
cd panoglview
sudo make install