Difference between revisions of "Hugin Compiling Ubuntu"

From PanoTools.org Wiki
Jump to navigation Jump to search
(updated runtime dependencies (python, and removed autopano-sift-c))
(37 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 
== Who Is This Page For ==
 
== Who Is This Page For ==
  
These instructions contain the collective wisdom of Hugin contributors that are using Ubuntu or any of its variations (Ku/Xu/Lu/Edu/...buntu).  They 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 'buntu versions up until 10.10.  They are intended to help contributors on the learning curve.  If you are not here to contribute, spare yourself the effort and see the [[#Shortcut]] section below.
+
These instructions contain the collective wisdom of Hugin contributors that are using Ubuntu or any of its variations (Ku/Xu/Lu/Edu/...buntu).  They 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 'buntu versions up until 12.04.  They are intended to help contributors on the learning curve.  If you are not here to contribute, spare yourself the effort and see the [[#Shortcut|Shortcut]] section below.
  
 
They are likely to work only for the latest 'buntu release, but you can check this page's history at the time that the older 'buntu version was the most recent one to find the specifics for that version.
 
They are likely to work only for the latest 'buntu release, but you can check this page's history at the time that the older 'buntu version was the most recent one to find the specifics for that version.
Line 7: Line 7:
 
If you are new here, read the whole page.  It is recommended that you go sequentially through it.
 
If you are new here, read the whole page.  It is recommended that you go sequentially through it.
  
If you're familiar with the process and have run it a few time, look at the what's new section for important news.
+
If you're familiar with the process and have run it a few times, look at the what's new section for important news.
  
Apart from the odd change in package name, nothing should be substantially different (and if does not work, please leave a comment on the [http://groups.google.com/group/hugin-ptx 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.
+
Apart from the odd change in package name, nothing should be substantially different (and if it does not work, please leave a comment on the [http://groups.google.com/group/hugin-ptx 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.:
<pre>apt-cache search wxW
+
 
 +
<pre>
 +
apt-cache search wxW
 
</pre>
 
</pre>
  
The goal is to build hugin and the whole set of helper applications required, and start understanding the building process.  You will need deeper understanding of the building process if you want to:
+
The goal is to build hugin and the whole set of helper applications required, and start understanding the building process.  You will need a deeper understanding of the building process if you want to:
 +
 
 
* develop code
 
* develop code
 
* translate the latest strings
 
* translate the latest strings
 
* document the latest features with manuals and tutorials
 
* document the latest features with manuals and tutorials
 
* package for distribution
 
* package for distribution
That knowledge is out of scope for this document.  This document ends with a binary that is fit for installation on your machine.  It is not fit for any other purpose, particularly not for distribution.  CMake is [http://groups.google.com/group/hugin-ptx/msg/3f29b207c562fd63 known] to build broken deb packages. Please do not distribute these binaries.
+
 
 +
That knowledge is beyond the scope of this document.  This document ends with a binary that is fit for installation on your machine.  It is not fit for any other purpose, particularly not for distribution.  CMake is [http://groups.google.com/group/hugin-ptx/msg/3f29b207c562fd63 known] to build broken deb packages. Please do not distribute these binaries.
  
 
== What's New ==
 
== What's New ==
 +
 +
'''25 January 2013''': The build instructions for the most recent versions of enblend, libpano13, and hugin have been updated for 'buntu 12.04LTS.  A lot of information applying to previous releases has been deleted in an effort to make the page more readable.  If you're building on an earlier release, be sure to click the "View History" tab above and check the build details around the time your 'buntu version was released.
 +
 +
'''9 May 2011''': The integration of the python_scripting development branch brings new dependencies and a new build-time configuration switch for Hugin.  See changes in the documentation below.  swig2.0 is officially distributed only with Natty (11.04 onwards).  If you have an older Ubuntu version you will either have to forego the python scripting feature or find an alternative swig2.0 (either a PPA or build it yourself).
 +
 
'''2 May 2011''': If you are using an earlier version of Ubuntu than 11.04, there is a chance that your Mercurial version is too old for grabbing updates. New (non-critical security) updates to a program do not get added to old versions of Ubuntu, so any new changes will need to be added manually. When running Mercurial (pull, update, etc), you may get an error like
 
'''2 May 2011''': If you are using an earlier version of Ubuntu than 11.04, there is a chance that your Mercurial version is too old for grabbing updates. New (non-critical security) updates to a program do not get added to old versions of Ubuntu, so any new changes will need to be added manually. When running Mercurial (pull, update, etc), you may get an error like
 +
 
<pre>
 
<pre>
 
abort: requirement 'dotencode' not supported!
 
abort: requirement 'dotencode' not supported!
 
</pre>
 
</pre>
 +
 
To fix this, you can use the package archive from Mercurial PPA Packagers and get the latest release:
 
To fix this, you can use the package archive from Mercurial PPA Packagers and get the latest release:
 +
 
<pre>
 
<pre>
 
sudo apt-add-repository ppa:mercurial-ppa/releases
 
sudo apt-add-repository ppa:mercurial-ppa/releases
Line 32: Line 44:
 
</pre>
 
</pre>
  
'''5-March-2010''': Foreign library libtclap removed from source tree.  This introduces a new dependency on libtclap-dev
+
'''5 March 2010''': Foreign library libtclap removed from source tree.  This introduces a new dependency on libtclap-dev
  
 
'''February 2010''': Libpano has migrated from SVN to Mercurial.
 
'''February 2010''': Libpano has migrated from SVN to Mercurial.
 
'''CMake 2.8.2''', as packaged in Ubuntu 10.10, contains a bug (http://public.kitware.com/Bug/view.php?id=11020) the prevents the created debs to install successfully, due to it not storing needed directories in the deb package.
 
Installing the resulting debs will fail with a message error saying something like
 
 
<pre>
 
unable to create `/usr/local/share/hugin/xrc/data/redo.png.dpkg-new' (while processing `./usr/local/share/hugin/xrc/data/redo.png'): No such file or directory
 
</pre>
 
 
Commands to create the necessary folders have been documented below and may be added to the CMake build in the repository of Hugin, Libpano, Enblend.  However it is possible that the lists are incomplete.  If you bump in the above message, the solution is to create the full missing path and run dpkg -i again, recursively adding folders until the install succeed.
 
 
<pre>
 
sudo mkdir -p /usr/local/share/hugin/xrc/data/
 
</pre>
 
 
Another workaround is, to partially rebuild the deb package by hand:
 
 
<pre>
 
mkdir unpacked
 
cd unpacked/
 
ar x ../hugin.build/hugin-2010.2.0-Linux.deb
 
mkdir untarred
 
cd untarred
 
tar xzf ../data.tar.gz
 
tar czf ../data.tar.gz .
 
cd ..
 
ar r ../hugin-2010.2.0-Linux.deb debian-binary control.tar.gz data.tar.gz
 
</pre>
 
  
 
== Shortcut ==
 
== Shortcut ==
Line 67: Line 52:
 
Hugin evolves fast and the official 'buntu distributions carry versions that are usually 3-6 months older than the 'buntu distribution date.  Moreover, they do not backport Hugin and related tools.
 
Hugin evolves fast and the official 'buntu distributions carry versions that are usually 3-6 months older than the 'buntu distribution date.  Moreover, they do not backport Hugin and related tools.
  
Even if you follow religiously the 'buntu six months update cycle, you may be using a version of Hugin that is one or two release cycles in our past.  If your sole objective is to use the new features of Hugin, the instructions in this section are for you.  Start a command line terminal, type the three commands and you're done.
+
Even if you religiously follow the 'buntu six months update cycle, you may be using a version of Hugin that is one or two release cycles in our past.  If your sole objective is to use the new features of Hugin, the instructions in this section are for you.  Start a command line terminal, type the three commands and you're done.
  
 
If for some reason that's not enough for you - if you want to actually learn and become a contributor; or if you're just curious about getting even closer to the bleeding edge and trade stability for features and excitement, the rest of this document is for you.
 
If for some reason that's not enough for you - if you want to actually learn and become a contributor; or if you're just curious about getting even closer to the bleeding edge and trade stability for features and excitement, the rest of this document is for you.
Line 73: Line 58:
 
=== Stable ===
 
=== Stable ===
  
This will install you the latest stable version of the tools:
+
This will install the latest stable version of the tools:
 
<pre>
 
<pre>
 
sudo add-apt-repository ppa:hugin/hugin-builds
 
sudo add-apt-repository ppa:hugin/hugin-builds
 
sudo apt-get update
 
sudo apt-get update
sudo apt-get install hugin enblend autopano-sift-c panini
+
sudo apt-get install hugin enblend panini
 
</pre>
 
</pre>
  
 
=== Unstable ===
 
=== Unstable ===
  
This will install you the latest unstable version of the tools that has been built as a binary.  While they are likely to work in most cases, there is no guarantee and they are not recommended for production environment.  Use at your own risk, and please report (and if possible fix) bugs.  Most of the time these unstable builds are closer to the bleeding edge than to the stable builds.  If you want the really really really bleeding edge, you'll have to work through the instructions in the next sections, though.
+
This will install the latest unstable version of the tools.  While they are likely to work in most cases, there is no guarantee and they are not recommended for a production environment.  Use at your own risk, and please report (and if possible fix) bugs.  Most of the time these unstable builds are closer to the bleeding edge than to the stable builds.  If you want the really really really bleeding edge, you'll have to work through the instructions in the next sections, though.
  
 
<pre>
 
<pre>
Line 88: Line 73:
 
sudo add-apt-repository ppa:hugin/nightly
 
sudo add-apt-repository ppa:hugin/nightly
 
sudo apt-get update
 
sudo apt-get update
sudo apt-get install hugin enblend autopano-sift-c panini
+
sudo apt-get install hugin enblend panini
 
</pre>
 
</pre>
  
 
== Building Environment ==
 
== 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))
 
  
<pre>sudo apt-get install build-essential autoconf automake1.9 libtool flex bison gdb libc6-dev libgcc1 \
+
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)), enter:
  cmake
+
 
 +
<pre>
 +
sudo apt-get install build-essential autoconf automake1.9 libtool flex bison gdb \
 +
  libc6-dev libgcc1 cmake pkg-config help2man checkinstall
 
</pre>
 
</pre>
  
Line 105: Line 91:
 
</pre>
 
</pre>
  
Not necessary, but useful if you want to revisit configuration sets in ccmake
+
Not necessary, but useful if you want to revisit configuration sets in ccmake:
 +
 
 
<pre>
 
<pre>
 
sudo apt-get install cmake-curses-gui
 
sudo apt-get install cmake-curses-gui
Line 111: Line 98:
  
 
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:
 
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:
 +
 
<pre>
 
<pre>
 
cd
 
cd
 
mkdir -p src
 
mkdir -p src
</pre>
 
 
=== For Coders ===
 
 
If you want to start to navigate, understand and modify the code, the doxygen generated documentation will be helpful to you.
 
 
<pre>
 
sudo apt-get install doxygen graphviz
 
 
</pre>
 
</pre>
  
Line 130: Line 110:
 
<pre>
 
<pre>
 
sudo apt-get install subversion-tools
 
sudo apt-get install subversion-tools
sudo echo 'deb-src ftp://ftp.at.debian.org/debian ../project/experimental main' > debian-experimental.list
+
sudo echo 'deb-src ftp://ftp.at.debian.org/debian ../project/experimental main' > /etc/apt/sources.list.d/debian-experimental.list
mv debian-experimental.list /etc/apt/sources.list.d/
 
 
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 55BE302B
 
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 55BE302B
 
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B8D7663
 
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B8D7663
Line 140: Line 119:
 
You will also need an OpenPGP key, and a Launchpad account.  Follow the [[Hugin_Trackers#Launchpad_Account|instructions]] for Launchpad account creation, including the signing of the Ubuntu Code of Conduct.
 
You will also need an OpenPGP key, and a Launchpad account.  Follow the [[Hugin_Trackers#Launchpad_Account|instructions]] for Launchpad account creation, including the signing of the Ubuntu Code of Conduct.
  
Moreover, it is likely that your environment is not clean enough for distribution builds. In that case, and to produce binaries for other Ubuntu series than the one you are running, you will want to set up a dchroot environment (to be documented later on).
+
Moreover, it is likely that your environment is not clean enough for distribution builds. In that case, and to produce binaries for other Ubuntu series than the one you are running, you will want to set up a dchroot environment (to be documented later on).
  
== Building Enblend ==
+
== Building Libpano13 ==
  
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.
+
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 development ("dev") packages:
  
 
<pre>
 
<pre>
sudo apt-get install pkg-config libtiff4-dev libboost-graph-dev libboost-thread-dev \
+
sudo apt-get install zlib1g-dev libpng12-dev libjpeg-dev libtiff-dev
  libboost-filesystem-dev liblcms1-dev libglew1.5-dev libplot-dev libglut3-dev libopenexr-dev \
 
  libxi-dev libxmu-dev help2man libplot-dev liblcms1-dev libboost-system-dev
 
 
</pre>
 
</pre>
  
If you also want to build the documentation, add the following dependencies, and add "-DDOC=ON" to the cmake command below.  (Be warned, however, that this will drag in over 700MB of additional dependencies.  Unless you have a pressing need to build the documentation yourself, you can save yourself some time and disk space by downloading the PDF docs from http://enblend.sourceforge.net .)
+
We then need to download the source code from the central repository:
  
 
<pre>
 
<pre>
sudo apt-get install texi2html texinfo fig2ps tidy gnuplot libxml-xpath-perl imagemagick
+
mkdir -p ~/src/libpano
 +
cd ~/src/libpano
 +
hg clone http://hg.code.sf.net/p/panotools/libpano13 libpano.hg
 
</pre>
 
</pre>
  
Once all dependencies are in place, get the code. The official repository has migrated from CVS to Mercurial:
+
If you're a contributor with write access, use the following clone command instead:
  
 
<pre>
 
<pre>
mkdir -p ~/src/enblend
+
hg clone ssh://USERNAME@hg.code.sf.net/p/panotools/libpano13 libpano.hg
cd ~/src/enblend
 
hg clone http://enblend.hg.sourceforge.net:8000/hgroot/enblend/enblend enblend.hg
 
 
</pre>
 
</pre>
  
If you already have checked out enblend, to update the code to the latest version you need to run:
+
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:
 +
 
 
<pre>
 
<pre>
cd enblend.hg
+
cd libpano.hg
 
hg pull
 
hg pull
hg update
+
hg up
 
cd ..
 
cd ..
 
</pre>
 
</pre>
  
Then create a build directory and build in there. And install the Package.
+
Now start the building process. Set -DCMAKE_BUILD_TYPE=Debug if you want to help investigate/debug a problem and capture even more debugging information.
  
The options below 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.
 
 
<pre>
 
<pre>
mkdir enblend.build
+
mkdir libpano.build
cd enblend.build
+
cd libpano.build
cmake ../enblend.hg -DENABLE_GPU:BOOL=ON -DENABLE_IMAGECACHE:BOOL=OFF -DENABLE_OPENMP:BOOL=ON \
+
cmake ../libpano.hg -DCMAKE_INSTALL_PREFIX=/usr/local -DCPACK_BINARY_DEB:BOOL=ON \
  -DCPACK_BINARY_DEB:BOOL=ON -DCPACK_BINARY_NSIS:BOOL=OFF -DCPACK_BINARY_RPM:BOOL=OFF \
+
  -DCPACK_BINARY_NSIS:BOOL=OFF -DCPACK_BINARY_RPM:BOOL=OFF -DCPACK_BINARY_STGZ:BOOL=OFF \
  -DCPACK_BINARY_STGZ:BOOL=OFF -DCPACK_BINARY_TBZ2:BOOL=OFF -DCPACK_BINARY_TGZ:BOOL=OFF \
+
  -DCPACK_BINARY_TBZ2:BOOL=OFF -DCPACK_BINARY_TGZ:BOOL=OFF -DCPACK_BINARY_TZ:BOOL=OFF \
  -DCPACK_BINARY_TZ:BOOL=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
+
  -DCMAKE_BUILD_TYPE=RelWithDebInfo
 
make package
 
make package
sudo dpkg -i enblend-4.1.1-Linux.deb
+
sudo dpkg -i libpano13-*-Linux.deb
 
</pre>
 
</pre>
  
If the install quits with an error, it is likely because of missing folders. Run the following commands and retry:
+
=== The old autotools way ===
 +
 
 +
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 completeness. You should not need it. However if you do, make sure to run either the CMake build or the autotools build on fresh repository checkouts to avoid interferences.
 +
 
 
<pre>
 
<pre>
sudo mkdir -p /usr/local/share/man/man1
+
./bootstrap
sudo mkdir -p /usr/local/bin
 
 
</pre>
 
</pre>
  
===The old autotools way===
+
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 <code>apt-cache search ''missingfile''</code>, find the relevant library and install both the library and the related <code>-dev</code> package.
We are then ready to compile. The CXXFLAGS <tt>--param inline-unit-growth=60</tt> 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, <tt>--disable-image-cache</tt> and <tt>--enable-openmp</tt> will speed up enblend/enfuse massively but may cause segmentation faults; in that case you will be better off with <tt>--enable-image-cache</tt> and <tt>--disable-openmp.</tt> <tt>-march=native</tt> is also beneficial and -O2 is better than -O3.
+
Run the <code>./configure</code> script and repeat this process until you have met all the dependencies.
 +
 
 +
Then we are ready to launch the make process with
  
 
<pre>
 
<pre>
make --makefile=Makefile.scm
 
mkdir BUILD
 
cd BUILD
 
CXXFLAGS="--param inline-unit-growth=60 -march=native -O2" ../configure --disable-image-cache \
 
  --enable-openmp
 
 
make
 
make
 
</pre>
 
</pre>
  
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 the library successfully compiles, you have to install it with
  
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
 
 
<pre>
 
<pre>
 
sudo make install
 
sudo make install
 +
sudo ldconfig
 
</pre>
 
</pre>
  
== Building Libpano13 ==
+
The last part is for the OS to be aware of the new library (that has been installed in <code>/usr/local/lib</code>).
  
libpano13 is the new version of the PanoTools libraries. This is a necessary component for hugin, and we need to build it first.
+
== Building Enblend ==
To build libpano13 we need some libraries and particularly their <code>dev</code> package:
 
  
<pre>sudo apt-get install zlib1g zlib1g-dev libpng12-dev libjpeg62-dev libtiff4-dev cmake</pre>
+
Get the dependencies. If you are working with large images (300 megapixels and up), you should have a libtiff-dev compiled with large file support and libstdc++6.
 
 
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 the central repository:
 
  
 
<pre>
 
<pre>
mkdir -p ~/src/libpano
+
sudo apt-get install libtiff4-dev libopenexr-dev libboost-system-dev \
cd ~/src/libpano
+
  libboost-filesystem-dev libboost-graph-dev libboost-thread-dev \
hg clone http://panotools.hg.sourceforge.net:8000/hgroot/panotools/libpano libpano.hg
+
  freeglut3-dev libglew-dev libxi-dev libxmu-dev libplot-dev libgsl0-dev \
 +
  liblcms2-dev
 
</pre>
 
</pre>
  
If you're a contributor with write access, use the following clone command instead:
+
UPDATE: the latest package libvigraimpex-dev included in Linux Mint 15 (=Ubuntu 13.04) has the version 1.9.0-0ubuntu2 - and I did not encounter any problems with using this instead of compiling it myself:
 
<pre>
 
<pre>
hg clone ssh://${USER}@panotools.hg.sourceforge.net/hgroot/panotools/panotools/libpano libpano.hg
+
sudo apt-get install libvigraimpex-dev
 
</pre>
 
</pre>
  
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:
+
If you still want to compile it yourself, here's how:
 +
The most recent version of Enblend (4.2) also requires version 1.9 of the VIGRA computer vision library. Unfortunately, 'buntu versions up to and including the forthcoming 13.04 (Raring Ringtail) only provide version 1.8 of the VIGRA library, so you'll have to build your own, as follows:
 +
 
 
<pre>
 
<pre>
cd libpano.hg
+
cd ~/src
hg pull
+
wget http://hci.iwr.uni-heidelberg.de/vigra/vigra-1.9.0-src.tar.gz
hg up
+
tar -zxvf vigra-1.9.0-src.tar.gz
cd ..
+
cd vigra-1.9.0
 +
cmake .
 +
sudo checkinstall
 +
sudo ldconfig
 
</pre>
 
</pre>
  
Now start the building process.
+
The <code>''"sudo checkinstall"''</code> step will ask you a few questions (respond with the default answers), and then create and install a package which can later be removed with synaptic or dpkg -r. If you're not worried about being able to cleanly remove the VIGRA library at a later date, you can substitute <code>''"sudo make install"''</code>.
 +
 
 +
If you also want to build the documentation, add the following dependencies, and add "-DDOC=ON" to the cmake command below.  (Be warned, however, that this will drag in over 700MB of additional dependencies.  Unless you have a pressing need to build the documentation yourself, you can save time and disk space by downloading the PDF docs from http://enblend.sourceforge.net .)
  
 
<pre>
 
<pre>
mkdir libpano.build
+
sudo apt-get install texi2html texinfo fig2ps tidy gnuplot libxml-xpath-perl imagemagick
cd libpano.build
 
cmake ../libpano.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 \
 
  -DCMAKE_BUILD_TYPE=RelWithDebInfo
 
make package
 
sudo dpkg -i libpano13-*-Linux.deb
 
 
</pre>
 
</pre>
  
Set -DCMAKE_BUILD_TYPE=Debug if you want to help investigate/debug a problem and capture even more debugging information.
+
Once all dependencies are in place, get the code. The official repository has migrated from CVS to Mercurial:
  
If the install quits with an error, it is likely because of missing folders.  Run the following commands and retry:
 
 
<pre>
 
<pre>
sudo mkdir -p /usr/local/include/pano13/
+
mkdir -p ~/src/enblend
sudo mkdir -p /usr/local/include/pano13/doc
+
cd ~/src/enblend
sudo mkdir -p /usr/local/lib/pkgconfig
+
hg clone http://hg.code.sf.net/p/enblend/code enblend.hg
sudo mkdir -p /usr/local/share/man/man1
 
sudo mkdir -p /usr/local/bin
 
 
</pre>
 
</pre>
  
=== The old autotools way ===
+
If you already have checked out enblend, to update the code to the latest version you need to run:
 
 
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 completeness. You should not need it. However if you do, make sure to run either the CMake build or the autotools build on fresh repository checkouts to avoid interferences.
 
  
 
<pre>
 
<pre>
./bootstrap
+
cd enblend.hg
 +
hg pull
 +
hg update
 +
cd ..
 
</pre>
 
</pre>
  
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 <code>apt-cache search ''missingfile''</code>, find the relevant library and install both the library and the related <code>-dev</code> package.
+
Then create a build directory and build in there. And install the package.
Run the <code>./configure</code> script and repeat this process until you have met all the dependencies.
 
  
Then we are ready to launch the make process with
+
The options below 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.
<pre>make</pre>
 
  
If the library successfully compiles, you have to install it with
+
<pre>
<pre>sudo make install
+
mkdir enblend.build
sudo ldconfig</pre>
+
cd enblend.build
The last part is for the OS to be aware of the new library (that has been installed in <code>/usr/local/lib</code>).
+
cmake ../enblend.hg -DENABLE_GPU:BOOL=ON -DENABLE_IMAGECACHE:BOOL=OFF -DENABLE_OPENMP:BOOL=ON \
We can now go back up one folder level and get ready for hugin.
+
  -DCPACK_BINARY_DEB:BOOL=ON -DCPACK_BINARY_NSIS:BOOL=OFF -DCPACK_BINARY_RPM:BOOL=OFF \
<pre>cd ..</pre>
+
  -DCPACK_BINARY_STGZ:BOOL=OFF -DCPACK_BINARY_TBZ2:BOOL=OFF -DCPACK_BINARY_TGZ:BOOL=OFF \
 +
  -DCPACK_BINARY_TZ:BOOL=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
 +
make package
 +
sudo dpkg -i enblend*.deb
 +
</pre>
  
 
== Building Hugin ==
 
== Building Hugin ==
Line 294: Line 264:
 
=== Dependencies ===
 
=== Dependencies ===
  
First we need to activate the <code>universe</code> repository (in adept package manager, or by editing the /etc/apt/sources.lst file for example) and get the dependencies.
+
First we need to activate the <code>universe</code> repository (in the synaptic package manager, or by editing the /etc/apt/sources.lst file for example) and get the dependencies.
  
 
The following command will install on your system all build time dependencies except libpano13.
 
The following command will install on your system all build time dependencies except libpano13.
 +
 
<pre>
 
<pre>
 
sudo apt-get install libwxgtk2.8-dev libtiff4-dev libpng12-dev \
 
sudo apt-get install libwxgtk2.8-dev libtiff4-dev libpng12-dev \
    libopenexr-dev libexiv2-dev libglut3-dev libglew-dev libboost-dev \
+
  libopenexr-dev libexiv2-dev freeglut3-dev libglew-dev libboost-dev \
    boost-build libboost-thread-dev libboost-graph-dev libboost-regex-dev \
+
  libboost-thread-dev libboost-regex-dev libboost-filesystem-dev \
    libboost-iostreams-dev libboost-filesystem-dev gettext liblapack-dev \
+
  libboost-iostreams-dev libboost-system-dev libboost-signals-dev \
    libxi-dev libxmu-dev libboost-signals-dev libboost-system-dev \
+
  gettext liblapack-dev libxi-dev libxmu-dev libtclap-dev liblensfun-dev
    libtclap-dev libpython-dev
 
 
</pre>
 
</pre>
  
You could install libpano13 on your system with the command below. However it is likely to be a version of libpano13 that is too old for the current Hugin.  It is recommended that you first build your own libpano13 (above).  Alternatively, there may be a recent enough version of libpano13 in the Hugin PPA.
+
If you want to build hugin with python scripting functionality, you will also need a copy of the python development library and swig2.0. Unfortunately, the swig2.0 package is only included in Natty (11.04) or better. If you are on Lucid or Maverick, you can obtain a swig2.0 package by enabling the Hugin PPA:
 +
 
 +
<pre>
 +
sudo add-apt-repository ppa:hugin/hugin-builds
 +
sudo apt-get update
 +
</pre>
 +
 
 +
Then (for all versions from Lucid onwards) execute:
 +
 
 +
<pre>
 +
sudo apt-get install python-dev swig2.0
 +
</pre>
 +
 
 +
You could install libpano13 on your system with the command below. But it is recommended that you build your own libpano13 (see section [[Hugin_Compiling_Ubuntu#Building_Libpano13|above]]), since the version of libpano13 in the Ubuntu repositories is probably too old.  Alternatively, there may be a recent enough version of libpano13 in the Hugin PPA. If going this last route, you can add it as shown above.
 +
 
 
<pre>
 
<pre>
 
sudo apt-get install libpano13-dev
 
sudo apt-get install libpano13-dev
Line 313: Line 297:
 
wxWidgets is a critical dependency for the Hugin GUI.  In the official Ubuntu repositories it is usually at least a few releases behind the current release, and in some cases many releases behind.  The wxWidgets project provides alternative [http://wiki.wxpython.org/InstallingOnUbuntuOrDebian repositories] with newer versions, as well as a [http://wiki.wxpython.org/BuildingDebianPackages instructions] to build binary packages of the most recent releases.  Newer versions of wxWidgets are not (yet) absolutely necessary, but since eventually things evolve they are useful for development, testing, and in general should give a better user interface experience as wxWidgets improves over time.
 
wxWidgets is a critical dependency for the Hugin GUI.  In the official Ubuntu repositories it is usually at least a few releases behind the current release, and in some cases many releases behind.  The wxWidgets project provides alternative [http://wiki.wxpython.org/InstallingOnUbuntuOrDebian repositories] with newer versions, as well as a [http://wiki.wxpython.org/BuildingDebianPackages instructions] to build binary packages of the most recent releases.  Newer versions of wxWidgets are not (yet) absolutely necessary, but since eventually things evolve they are useful for development, testing, and in general should give a better user interface experience as wxWidgets improves over time.
  
The following are run-time dependencies.  Strictly speaking you don't need them to build Hugin, but you will need them to use it.  You don't need this line if you follow the instructions on this page to build ExifTool, Enblend.
+
The following are run-time dependencies.  Strictly speaking you don't need them to build Hugin, but you will need them to use it.  If you follow the instructions on this page to build ExifTool and/or Enblend, you don't need to install them this way.
 +
 
 
<pre>
 
<pre>
 
sudo apt-get install libimage-exiftool-perl enblend python-argparse
 
sudo apt-get install libimage-exiftool-perl enblend python-argparse
 +
</pre>
 +
 +
'''Note:''' If you use Python 2.7, there is no need to install "python-argparse" package. Because Python 2.7 has included "argparse" as its core module. Ubuntu 13.10 has Python 2.7 installed by default, so one will find that there is no "python-argparse" package in Ubuntu's repository. For Ubuntu 13.10, you can install run-time dependencies as:
 +
<pre>
 +
sudo apt-get install libimage-exiftool-perl enblend
 
</pre>
 
</pre>
  
Line 321: Line 311:
  
 
If you already have a repository clone, you only need to pull the latest changes and update the code with:
 
If you already have a repository clone, you only need to pull the latest changes and update the code with:
 +
 
<pre>
 
<pre>
 
cd ~/src/hugin/hugin.hg
 
cd ~/src/hugin/hugin.hg
Line 328: Line 319:
  
 
Otherwise, you need to clone the repository and decide which version/branch to build with:
 
Otherwise, you need to clone the repository and decide which version/branch to build with:
 +
 
<pre>
 
<pre>
 
mkdir -p ~/src/hugin
 
mkdir -p ~/src/hugin
 
cd ~/src/hugin
 
cd ~/src/hugin
hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/hugin hugin.hg
+
hg clone http://hg.code.sf.net/p/hugin/hugin hugin.hg
 
cd hugin.hg
 
cd hugin.hg
 
hg branches
 
hg branches
Line 337: Line 329:
  
 
If you are a contributor with write access, you can use
 
If you are a contributor with write access, you can use
 +
 
<pre>
 
<pre>
hg clone ssh://${USER}@hugin.hg.sourceforge.net/hgroot/hugin/hugin hugin.hg
+
hg clone ssh://${USER}@hg.code.sf.net/p/hugin/hugin hugin.hg
 
</pre>
 
</pre>
  
 
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:
 
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:
 +
 
<pre>
 
<pre>
 
hg update -C 2010.0  
 
hg update -C 2010.0  
Line 358: Line 352:
  
 
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:
 
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:
 +
 
<pre>
 
<pre>
 
cd ~/src/hugin/hugin.hg
 
cd ~/src/hugin/hugin.hg
Line 381: Line 376:
 
<pre>
 
<pre>
 
cd ~/src/hugin
 
cd ~/src/hugin
mkdir hugin.hg-build
+
mkdir hugin.build
cd hugin.hg-build
+
cd hugin.build
 
cmake ../hugin.hg -DENABLE_LAPACK=YES -DCPACK_BINARY_DEB:BOOL=ON -DCPACK_BINARY_NSIS:BOOL=OFF \
 
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_RPM:BOOL=OFF -DCPACK_BINARY_STGZ:BOOL=OFF -DCPACK_BINARY_TBZ2:BOOL=OFF \
 
   -DCPACK_BINARY_TGZ:BOOL=OFF -DCPACK_BINARY_TZ:BOOL=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo \
 
   -DCPACK_BINARY_TGZ:BOOL=OFF -DCPACK_BINARY_TZ:BOOL=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo \
   -DBUILD_HSI:BOOL=ON
+
   -DBUILD_HSI:BOOL=ON -DSWIG_EXECUTABLE=/usr/bin/swig2.0
 
</pre>
 
</pre>
  
Set -DCMAKE_BUILD_TYPE=Debug if you want to help investigate/debug a problem and capture even more debugging information, however Hugin will be slower and may not work as expected.  Don't use a Debug build for production.
+
The last line of the above cmake statement is for python scripting.  The first switch activates the scripting interface (which is deactivated by default because it does not work simply out of the box on all supported platforms) and the second switch fixes a bug in the CMake script to find swig.  Self-compiled swig does not need the -DSWIG_EXECUTABLE switch since it is found automatically by the CMake script.
 +
 
 +
If you get an error building, try removing the last line of the above cmake statement. Another cause may be a wrong version of libpano13, even if you built it yourself. Go back and check that you are using a (newer) stable branch. Try switching to libpano13-2.9.18 (run hg update -C libpano13-2.9.18 in the proper folder), rebuild as instructed above, and try again.
 +
 
 +
Set '''-DCMAKE_BUILD_TYPE=Debug''' if you want to help investigate/debug a problem and capture even more debugging information (for example, this will enable DEBUG_DEBUG(...) to output debug message), however Hugin will be slower and may not work as expected.  Don't use a Debug build for production.
 +
 
 +
Set '''-DREBUILD_TRANSLATIONS=ON''' if you want to rebuild translation each compile time.
 +
 
 +
If you are building for install on your own machine only, -DDISABLE_DPKG=ON will significantly speed up the package generation.  Do not distribute packages built this way, they don't have proper dependencies.  This is primarily meant for developers doing cycles of fix-compile-install-test.
  
 
=== Build and Install ===
 
=== 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:
+
Finally, we use make to build the code and package it, and dpkg to install it.
  
 
<pre>
 
<pre>
Line 399: Line 402:
 
sudo dpkg -i hugin-*-Linux.deb
 
sudo dpkg -i hugin-*-Linux.deb
 
sudo ldconfig
 
sudo ldconfig
</pre>
 
 
If the install quits with an error, it is likely because of missing folders. Run the following commands and retry:
 
<pre>
 
sudo mkdir -p /usr/local/share/pixmaps
 
sudo mkdir -p /usr/local/share/mime/packages
 
sudo mkdir -p /usr/local/share/applications/
 
sudo mkdir -p /usr/local/share/icons/gnome/48x48/mimetypes/
 
sudo mkdir -p /usr/local/share/locale/en_GB/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/es_la/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/fr/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/zh_TW/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/ru/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/ro/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/bg/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/de/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/ko/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/pt_BR/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/zh_CN/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/ja/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/it/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/sl/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/sk/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/sv/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/ca_ES/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/nl/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/fi/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/cs_CZ/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/uk/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/es/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/pl/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/hu/LC_MESSAGES/
 
sudo mkdir -p /usr/local/share/locale/es_VE/LC_MESSAGES
 
sudo mkdir -p /usr/local/share/hugin/xrc/data/help_it_IT
 
sudo mkdir -p /usr/local/share/hugin/xrc/data/help_en_EN
 
sudo mkdir -p /usr/local/share/hugin/data/
 
sudo mkdir -p /usr/local/lib/hugin
 
sudo mkdir -p /usr/local/share/man/man1
 
 
</pre>
 
</pre>
  
Line 445: Line 410:
 
=== Dive into the Code ===
 
=== Dive into the Code ===
  
From time to time the API reference is published on the Hugin website, however you are better off with a local copy. To generate it, issue the following commands:
+
If you want to start to navigate, understand and modify the code, the doxygen generated documentation will be helpful to you.
 +
 
 
<pre>
 
<pre>
 +
sudo apt-get install doxygen graphviz
 
cd ~/src/hugin/hugin.hg/src
 
cd ~/src/hugin/hugin.hg/src
 
doxygen Doxyfile
 
doxygen Doxyfile
 
</pre>
 
</pre>
  
The documentation is generated in ~/src/hugin/hugin.hg/src/hugin/html
+
Point your browser to ~/src/hugin/hugin.hg/src/hugin/html/index.html and you have access to all available information.  If you find that a class, a function, or anything else is not properly documented; and if you delve into the source code to understand it, kindly add documentation to the code so that the next person in your situation can use your experience as a stepping stone.  Thank you!
 
 
Point your browser to index.html inside that folder and you have access to all available information.  If you find that a class, a function, or anything else is not properly documented; and if you delve into the source code to understand it, kindly add documentation to the code so that the next person in your situation can use your experience as a stepping stone.  Thank you!
 
  
 
== Automatic Control Point Detectors ==
 
== Automatic Control Point Detectors ==
Line 522: Line 487:
 
including match-n-shift:
 
including match-n-shift:
  
   svn co https://panotools.svn.sourceforge.net/svnroot/panotools/trunk/Panotools-Script Panotools-Script
+
   hg clone http://hg.code.sf.net/p/panotools/Panotools-Script Panotools-Script
 
   cd Panotools-Script
 
   cd Panotools-Script
 
   perl Makefile.PL
 
   perl Makefile.PL
Line 738: Line 703:
 
The deb packages built by CMake (2.8.2) are broken by Debian standard.  Please do not distribute them.  There are official updated recent packages at the Hugin PPA mentioned above which include nightlies (produced every 24 hours) and stables (produced out of released tarballs).  If you miss binaries for your series of Ubuntu and you have built them for yourself following the instructions above, considering moving up one level and contributing to the [[Hugin PPA]].
 
The deb packages built by CMake (2.8.2) are broken by Debian standard.  Please do not distribute them.  There are official updated recent packages at the Hugin PPA mentioned above which include nightlies (produced every 24 hours) and stables (produced out of released tarballs).  If you miss binaries for your series of Ubuntu and you have built them for yourself following the instructions above, considering moving up one level and contributing to the [[Hugin PPA]].
  
 +
[[Category:Software:Platform:Linux]]
 
[[Category:Software:Hugin]]
 
[[Category:Software:Hugin]]
[[Category:Software:Platform:Linux]]
+
[[Category:Software:Hugin:Compiling]]

Revision as of 14:43, 10 November 2013

Who Is This Page For

These instructions contain the collective wisdom of Hugin contributors that are using Ubuntu or any of its variations (Ku/Xu/Lu/Edu/...buntu). They 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 'buntu versions up until 12.04. They are intended to help contributors on the learning curve. If you are not here to contribute, spare yourself the effort and see the Shortcut section below.

They are likely to work only for the latest 'buntu release, but you can check this page's history at the time that the older 'buntu version was the most recent one to find the specifics for that version.

If you are new here, read the whole page. It is recommended that you go sequentially through it.

If you're familiar with the process and have run it a few times, look at the what's new section for important news.

Apart from the odd change in package name, nothing should be substantially different (and if it 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, and start understanding the building process. You will need a deeper understanding of the building process if you want to:

  • develop code
  • translate the latest strings
  • document the latest features with manuals and tutorials
  • package for distribution

That knowledge is beyond the scope of this document. This document ends with a binary that is fit for installation on your machine. It is not fit for any other purpose, particularly not for distribution. CMake is known to build broken deb packages. Please do not distribute these binaries.

What's New

25 January 2013: The build instructions for the most recent versions of enblend, libpano13, and hugin have been updated for 'buntu 12.04LTS. A lot of information applying to previous releases has been deleted in an effort to make the page more readable. If you're building on an earlier release, be sure to click the "View History" tab above and check the build details around the time your 'buntu version was released.

9 May 2011: The integration of the python_scripting development branch brings new dependencies and a new build-time configuration switch for Hugin. See changes in the documentation below. swig2.0 is officially distributed only with Natty (11.04 onwards). If you have an older Ubuntu version you will either have to forego the python scripting feature or find an alternative swig2.0 (either a PPA or build it yourself).

2 May 2011: If you are using an earlier version of Ubuntu than 11.04, there is a chance that your Mercurial version is too old for grabbing updates. New (non-critical security) updates to a program do not get added to old versions of Ubuntu, so any new changes will need to be added manually. When running Mercurial (pull, update, etc), you may get an error like

abort: requirement 'dotencode' not supported!

To fix this, you can use the package archive from Mercurial PPA Packagers and get the latest release:

sudo apt-add-repository ppa:mercurial-ppa/releases
sudo apt-get update
sudo apt-get install mercurial

5 March 2010: Foreign library libtclap removed from source tree. This introduces a new dependency on libtclap-dev

February 2010: Libpano has migrated from SVN to Mercurial.

Shortcut

Hugin evolves fast and the official 'buntu distributions carry versions that are usually 3-6 months older than the 'buntu distribution date. Moreover, they do not backport Hugin and related tools.

Even if you religiously follow the 'buntu six months update cycle, you may be using a version of Hugin that is one or two release cycles in our past. If your sole objective is to use the new features of Hugin, the instructions in this section are for you. Start a command line terminal, type the three commands and you're done.

If for some reason that's not enough for you - if you want to actually learn and become a contributor; or if you're just curious about getting even closer to the bleeding edge and trade stability for features and excitement, the rest of this document is for you.

Stable

This will install the latest stable version of the tools:

sudo add-apt-repository ppa:hugin/hugin-builds
sudo apt-get update
sudo apt-get install hugin enblend panini

Unstable

This will install the latest unstable version of the tools. While they are likely to work in most cases, there is no guarantee and they are not recommended for a production environment. Use at your own risk, and please report (and if possible fix) bugs. Most of the time these unstable builds are closer to the bleeding edge than to the stable builds. If you want the really really really bleeding edge, you'll have to work through the instructions in the next sections, though.

sudo add-apt-repository ppa:hugin/hugin-builds
sudo add-apt-repository ppa:hugin/nightly
sudo apt-get update
sudo apt-get install hugin enblend panini

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)), enter:

sudo apt-get install build-essential autoconf automake1.9 libtool flex bison gdb \
  libc6-dev libgcc1 cmake pkg-config help2man checkinstall

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 revisit configuration sets in ccmake:

sudo apt-get install cmake-curses-gui

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

For Distributors

If you want to build packages for distribution, you will also need the following tools and settings.

sudo apt-get install subversion-tools
sudo echo 'deb-src ftp://ftp.at.debian.org/debian ../project/experimental main' > /etc/apt/sources.list.d/debian-experimental.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 55BE302B
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B8D7663
sudo apt-get update
sudo apt-get install devscripts

You will also need an OpenPGP key, and a Launchpad account. Follow the instructions for Launchpad account creation, including the signing of the Ubuntu Code of Conduct.

Moreover, it is likely that your environment is not clean enough for distribution builds. In that case, and to produce binaries for other Ubuntu series than the one you are running, you will want to set up a dchroot environment (to be documented later on).

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 development ("dev") packages:

sudo apt-get install zlib1g-dev libpng12-dev libjpeg-dev libtiff-dev

We then need to download the source code from the central repository:

mkdir -p ~/src/libpano
cd ~/src/libpano
hg clone http://hg.code.sf.net/p/panotools/libpano13 libpano.hg

If you're a contributor with write access, use the following clone command instead:

hg clone ssh://USERNAME@hg.code.sf.net/p/panotools/libpano13 libpano.hg

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 libpano.hg
hg pull
hg up
cd ..

Now start the building process. Set -DCMAKE_BUILD_TYPE=Debug if you want to help investigate/debug a problem and capture even more debugging information.

mkdir libpano.build
cd libpano.build
cmake ../libpano.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 \
   -DCMAKE_BUILD_TYPE=RelWithDebInfo
make package
sudo dpkg -i libpano13-*-Linux.deb

The old autotools way

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 completeness. You should not need it. However if you do, make sure to run either the CMake build or the autotools build on fresh repository checkouts to avoid interferences.

./bootstrap

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

make

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).

Building Enblend

Get the dependencies. If you are working with large images (300 megapixels and up), you should have a libtiff-dev compiled with large file support and libstdc++6.

sudo apt-get install libtiff4-dev libopenexr-dev libboost-system-dev \
  libboost-filesystem-dev libboost-graph-dev libboost-thread-dev \
  freeglut3-dev libglew-dev libxi-dev libxmu-dev libplot-dev libgsl0-dev \
  liblcms2-dev

UPDATE: the latest package libvigraimpex-dev included in Linux Mint 15 (=Ubuntu 13.04) has the version 1.9.0-0ubuntu2 - and I did not encounter any problems with using this instead of compiling it myself:

sudo apt-get install libvigraimpex-dev

If you still want to compile it yourself, here's how: The most recent version of Enblend (4.2) also requires version 1.9 of the VIGRA computer vision library. Unfortunately, 'buntu versions up to and including the forthcoming 13.04 (Raring Ringtail) only provide version 1.8 of the VIGRA library, so you'll have to build your own, as follows:

cd ~/src
wget http://hci.iwr.uni-heidelberg.de/vigra/vigra-1.9.0-src.tar.gz
tar -zxvf vigra-1.9.0-src.tar.gz
cd vigra-1.9.0
cmake .
sudo checkinstall
sudo ldconfig

The "sudo checkinstall" step will ask you a few questions (respond with the default answers), and then create and install a package which can later be removed with synaptic or dpkg -r. If you're not worried about being able to cleanly remove the VIGRA library at a later date, you can substitute "sudo make install".

If you also want to build the documentation, add the following dependencies, and add "-DDOC=ON" to the cmake command below. (Be warned, however, that this will drag in over 700MB of additional dependencies. Unless you have a pressing need to build the documentation yourself, you can save time and disk space by downloading the PDF docs from http://enblend.sourceforge.net .)

sudo apt-get install texi2html texinfo fig2ps tidy gnuplot libxml-xpath-perl imagemagick

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://hg.code.sf.net/p/enblend/code enblend.hg

If you already have checked out enblend, to update the code to the latest version you need to run:

cd enblend.hg
hg pull
hg update
cd ..

Then create a build directory and build in there. And install the package.

The options below 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.

mkdir enblend.build
cd enblend.build
cmake ../enblend.hg -DENABLE_GPU:BOOL=ON -DENABLE_IMAGECACHE:BOOL=OFF -DENABLE_OPENMP:BOOL=ON \
  -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 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=/usr/local
make package
sudo dpkg -i enblend*.deb

Building Hugin

Dependencies

First we need to activate the universe repository (in the synaptic package manager, or by editing the /etc/apt/sources.lst file for example) and get the dependencies.

The following command will install on your system all build time dependencies except libpano13.

sudo apt-get install libwxgtk2.8-dev libtiff4-dev libpng12-dev \
  libopenexr-dev libexiv2-dev freeglut3-dev libglew-dev libboost-dev \
  libboost-thread-dev libboost-regex-dev libboost-filesystem-dev \
  libboost-iostreams-dev libboost-system-dev libboost-signals-dev \
  gettext liblapack-dev libxi-dev libxmu-dev libtclap-dev liblensfun-dev

If you want to build hugin with python scripting functionality, you will also need a copy of the python development library and swig2.0. Unfortunately, the swig2.0 package is only included in Natty (11.04) or better. If you are on Lucid or Maverick, you can obtain a swig2.0 package by enabling the Hugin PPA:

sudo add-apt-repository ppa:hugin/hugin-builds
sudo apt-get update

Then (for all versions from Lucid onwards) execute:

sudo apt-get install python-dev swig2.0

You could install libpano13 on your system with the command below. But it is recommended that you build your own libpano13 (see section above), since the version of libpano13 in the Ubuntu repositories is probably too old. Alternatively, there may be a recent enough version of libpano13 in the Hugin PPA. If going this last route, you can add it as shown above.

sudo apt-get install libpano13-dev

wxWidgets is a critical dependency for the Hugin GUI. In the official Ubuntu repositories it is usually at least a few releases behind the current release, and in some cases many releases behind. The wxWidgets project provides alternative repositories with newer versions, as well as a instructions to build binary packages of the most recent releases. Newer versions of wxWidgets are not (yet) absolutely necessary, but since eventually things evolve they are useful for development, testing, and in general should give a better user interface experience as wxWidgets improves over time.

The following are run-time dependencies. Strictly speaking you don't need them to build Hugin, but you will need them to use it. If you follow the instructions on this page to build ExifTool and/or Enblend, you don't need to install them this way.

sudo apt-get install libimage-exiftool-perl enblend python-argparse

Note: If you use Python 2.7, there is no need to install "python-argparse" package. Because Python 2.7 has included "argparse" as its core module. Ubuntu 13.10 has Python 2.7 installed by default, so one will find that there is no "python-argparse" package in Ubuntu's repository. For Ubuntu 13.10, you can install run-time dependencies as:

sudo apt-get install libimage-exiftool-perl enblend

Fetch the Source Code with Mercurial

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

Otherwise, you need to clone the repository and decide which version/branch to build with:

mkdir -p ~/src/hugin
cd ~/src/hugin
hg clone http://hg.code.sf.net/p/hugin/hugin hugin.hg
cd hugin.hg
hg branches

If you are a contributor with write access, you can use

hg clone ssh://${USER}@hg.code.sf.net/p/hugin/hugin hugin.hg

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

Reference: [1]

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.build
cd hugin.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 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
   -DBUILD_HSI:BOOL=ON -DSWIG_EXECUTABLE=/usr/bin/swig2.0

The last line of the above cmake statement is for python scripting. The first switch activates the scripting interface (which is deactivated by default because it does not work simply out of the box on all supported platforms) and the second switch fixes a bug in the CMake script to find swig. Self-compiled swig does not need the -DSWIG_EXECUTABLE switch since it is found automatically by the CMake script.

If you get an error building, try removing the last line of the above cmake statement. Another cause may be a wrong version of libpano13, even if you built it yourself. Go back and check that you are using a (newer) stable branch. Try switching to libpano13-2.9.18 (run hg update -C libpano13-2.9.18 in the proper folder), rebuild as instructed above, and try again.

Set -DCMAKE_BUILD_TYPE=Debug if you want to help investigate/debug a problem and capture even more debugging information (for example, this will enable DEBUG_DEBUG(...) to output debug message), however Hugin will be slower and may not work as expected. Don't use a Debug build for production.

Set -DREBUILD_TRANSLATIONS=ON if you want to rebuild translation each compile time.

If you are building for install on your own machine only, -DDISABLE_DPKG=ON will significantly speed up the package generation. Do not distribute packages built this way, they don't have proper dependencies. This is primarily meant for developers doing cycles of fix-compile-install-test.

Build and Install

Finally, we use make to build the code and package it, and dpkg to install it.

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.

Reference: [2]

Dive into the Code

If you want to start to navigate, understand and modify the code, the doxygen generated documentation will be helpful to you.

sudo apt-get install doxygen graphviz
cd ~/src/hugin/hugin.hg/src
doxygen Doxyfile

Point your browser to ~/src/hugin/hugin.hg/src/hugin/html/index.html and you have access to all available information. If you find that a class, a function, or anything else is not properly documented; and if you delve into the source code to understand it, kindly add documentation to the code so that the next person in your situation can use your experience as a stepping stone. Thank you!

Automatic Control Point Detectors

Autopano-sift-C

Pre-Requisites:

sudo apt-get install libxml2-dev

To build

(Note February 2011: The latest source code of autopano-sift-C has been unstable for a long time now and nobody is working to fix it. 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 \
   -DCMAKE_BUILD_TYPE=Debug
make package
sudo dpkg -i autopano-sift-C-*-Linux.deb

Match-n-shift

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:

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

 hg clone http://hg.code.sf.net/p/panotools/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

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
cd ~/src/hugin/hugin.hg-build
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)

Pan-o-matic

Yet another control point generator Home Page

sudo apt-get install libboost-dev

Download Panomatic 0.9.4 bz2 and if you're on Ubuntu 9.10 or newer also the patch for the gcc4.4 compiler.

mkdir -p ~/src/panomatic
cd ~/src/panomatic
wget "http://aorlinsk2.free.fr/panomatic/download.php?d=7&v=0.9.4" -O panomatic-0.9.4-src.tar.bz2
wget http://aorlinsk2.free.fr/panomatic/panomatic_gcc44.patch patch
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 autopano-SIFT program"
  • Choose the path to the binary ( /usr/local/bin )
  • In Arguments, put : -o %o %i

Pablo's variation

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: [3]

o daisy: [4]

o descriptor learning: [5]

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: --sieve1size 100 --sieve2size 2 -o %o %i

ExifTool

ExifTool is no longer mandatory for Hugin to work. It is used to pass metadata from the input to the output images during the stitching process.

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.

Usually the version distributed with Ubuntu (8.15 in Ubuntu 10.10; 7.89 in Ubuntu 10.4) is good enough and you don't need to bother with the following instructions. However there were situations in the past and there might be situations in the future where the latest versions offer better support. These issues will occur most likely with specific camera brands/models and the most recent models. The following instructions are for those cases.

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

Pano Viewers

PanoGLView

PanoGLView is an OpenGL hardware accelerated interactive immersive viewer for equirectangular images.

Pre-Requisites:

sudo apt-get install wx-common libwxgtk2.8-dev libglew-dev

To build and install:

mkdir -p ~/src/panoglview
cd ~/src/panoglview
hg clone http://hugin.hg.sourceforge.net:8000/hgroot/hugin/panoglview panoglview.hg
cd panoglview.hg
hg update
./bootstrap
./configure
make
sudo make install

FreePV - DEPENDENCIES ARE BROKEN - FAILS TO BUILD

Pre-Requisites:

sudo apt-get install cmake make pkg-config g++ mozilla-devscripts freeglut3-dev zlib1g-dev \
   libjpeg-dev libxext-dev libxmu-dev x11proto-xf86vidmode-dev libxxf86vm-dev libnspr4-dev \
   libxml2-dev libpng12-dev

To build

svn co https://freepv.svn.sourceforge.net/svnroot/freepv/freepv/trunk/ freepv
cd freepv
cmake .
make
sudo make install

Panini Perspective Tool

Strictly speaking, Panini is more than just a viewer. It's a powerful tool to extract/transform views and can also be easily used as a viewer.

Get dependencies:

sudo apt-get install qt4-qmake libqt4-dev zlib1g-dev

Get code:

mkdir -p ~/src/pvqt
cd ~/src/pvqt
svn co https://pvqt.svn.sourceforge.net/svnroot/pvqt pvqt.svn

Build:

cd pvqt.svn
qmake panini.pro
make

Install (brute force):

sudo cp Panini /usr/local/bin/ 

Menu Entry for Kubuntu:

kmenuedit

in kmenuedit

  • navigate to Graphics
    • click on New Item
    • Enter "Panini" as Name
    • Enter "Perspective Tool" as Description
    • click on the empty icon and look for an icon (I used the akonadi one)
    • Enter "Panini" as Command
    • Click on Save button

Notes for Packagers

Tarballs

  • to get an updated ChangeLog in Mercurial repositories (Hugin has it also in the cmake invocation, use -DUPDATE_CHANGELOG=1)
hg log --follow --style=changelog 
  • to update the ChangeLog in SVN repositories (Panotools)
svn up
svn2cl
svn ci

Deb Packages

The deb packages built by CMake (2.8.2) are broken by Debian standard. Please do not distribute them. There are official updated recent packages at the Hugin PPA mentioned above which include nightlies (produced every 24 hours) and stables (produced out of released tarballs). If you miss binaries for your series of Ubuntu and you have built them for yourself following the instructions above, considering moving up one level and contributing to the Hugin PPA.