Hugin Compiling OSX

From PanoTools.org Wiki
Revision as of 08:08, 9 September 2009 by Garglebutt (Talk | contribs)

Jump to: navigation, search

Contents

Introduction

This tutorial describes how to build Hugin on OSX via MacPorts. Fink users should also be able to use it even though the commands and directory structure is different from MacPorts.

  • Directory structure where everything is built and installed:
    • MacPorts: /opt/local
    • Fink: /sw
  • Main commands to install/update/uninstall/deactivate packages:
    • MacPorts: sudo port [install][update][uninstall][search] <package1> <package2> <packagex>
    • Fink: sudo apt-get [install][update][uninstall][search] <package1> <package2> <packagex>

Note: These are only the most used command options for both port and apt-get. See their respective websites Macports.org and Finkproject.org for documentation.

Note: This Howto does not describe how to build a portable universal application. You can use the Build a MacOSX Universal Hugin bundle with Xcode

Note: In case you encounter problems, report them on the Hugin mailing list.

Building environment

Download and install XCode

Download and install the XCode Tools version for your MacOSX version: Xcode 2.5.x for MacOSX 10.4.x or below and Xcode 3.1.x for 10.5.x (Leopard). You will not use the Xcode development environment itself, but the MacOSX system comes without the GNU compiler, builder, linker and so on.

Install CMake

Get and install the build system CMake, version 2.4.8, from CMake. Note: Currently (Oct 2008) Hugin can't be compiled with cmake 2.6.x. Stick to 2.4.8

Install Macports

If you don't have it already, install MacPorts, which provides the port command, from MacPorts, giving you compilable package access to thousands of pieces of open source software. If you already have macports (formerly darwinports) installed, update it:

sudo port selfupdate

Make sure you have synced the latest port files:

sudo port -d sync

Fink commander

Note: This tutorial describes how to build Hugin with MacPorts. This should more or less be the same for Fink. All references to /opt/local that are mentioned here for MacPorts should be changed with /sw for Fink. You may find Fink Commander helpful. Unfortunately it seems unsupported / unmaintained. The Fink FAQ may help. Can somebody please describe here how to install Fink and Fink Commander?

Porticus

You may find Porticus helpful with MacPorts

Subversion (SVN)

You need to get and install Subversion from MacPorts. If you fancy a nice GUI you can download the Open-Source SVNX. You still need svn installed as it is only a graphical shell and I won't explain SVNX here (I only used it once, I still like the terminal). Note: A previous version of this wiki mentioned that you don't need to install SVN on Leopard as it comes pre-installed. however, this pre-installed version is (way) too old so you need the newer version from MacPorts anyway.

Install necessary libraries

Use port to install the necessary libraries and commands for Hugin:

sudo port install boost tiff jpeg libpng wxWidgets subversion openexr exiv2 glew

Wait as all of these source packages (and it's dependencies) are downloaded and compiled, and installed into /opt/local. Go get a frappe, walk the dog, and total the first 1000 prime numbers in binary.

Note: Some users have problems installing boost on Leopard. See [1] for possible solutions. I might help to just enter"

sudo port clean --work boost
sudo port install boost

"in the terminal after the first run of installing all libraries.

libpano13

Download and build libpano13 from SourceForge.

Build SVN libpano13

Grab a copy of the source code:

svn co https://panotools.svn.sourceforge.net/svnroot/panotools panotools

To build and install the svn version (preferred) you first need to edit the bootstrap file and change LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} to LIBTOOLIZE=${LIBTOOLIZE:-glibtoolize}.

cd DirectoryWherePanotoolsIs/panotools/trunk/libpano
nano bootstrap (or do it with your preferred editor)

Now you can build the library:

./bootstrap --with-jpeg=/opt/local/ --with-tiff=/opt/local/ --with-png=/opt/local/
export CFLAGS="-I/opt/local/include -L/opt/local/lib"
./configure
make
sudo make install

By default it will go into /usr/local/lib).

WxWidgets

Tiger (10.4.x)

Fix a problem on Tiger (10.4.x): Tiger comes with WxWindows version 2.5. The Hugin cmake will search OS paths first and will find Tiger's own version 2.5 instead of your freshly compiled 2.8. You need to get Tiger's 2.5 version out of the way as you won't be able to build Hugin succesfully as long as it is in place.

sudo mv /usr/bin/wx-config /usr/bin/wx-config-2.5
sudo mv /usr/include/wx-2.5 /usr/include/wx-2.5-macTiger

Leopard (10.5.x)

Fix a problem on Leopard (10.5.x): Leopard comes with WxWindows version 2.8.4. The Hugin cmake will search OS paths first and will find Leopard's own version 2.8.4 instead of your freshly compiled 2.8.8 or above. You need to get Tiger's 2.8.4 version out of the way. Hugin will build succesfully with 2.8.4 and will run. However version 2.8.4 still contains some bugs that will cause "bleeding through" in the graphical CP windows. This means that when things change in wxwidgets objects, sometimes (most of the times) the CP window displays through your current GUI screen.

sudo mv /usr/bin/wx-config /usr/bin/wx-config-2.8.4
sudo mv /usr/include/wx-2.8 /usr/include/wx-2.8-macLeopard

Snow Leopard (10.6.x)

Snow Leopard comes with WxWindows 2.8.8 so no changes are required.

Fix libboost

Fix a (hopefully temporary) issue with Macport's threaded Boost library not providing generic link names for libboost_thread:

cd /opt/local/lib
sudo ln -s libboost_thread-mt.a libboost_thread.a
sudo ln -s libboost_thread-mt.dylib libboost_thread.dylib
cd -

Build Hugin

Get Hugin from SVN

Check out the hugin sources from SVN, like:

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

If you are asked to accept the ssl key from the sourceforge svn server, do accept it permanently (p). Otherwise the configuring process using cmake will fail.

Create hugin build directory

Create another directory alongside the newly created hugin/ for the build files (a cool feature of CMake: it doesn't need to pollute your source directory with build files!):

mkdir hugin_build; cd hugin_build

Note: You can give this directory any name you want, but hugin_build is chosen for it's clarity.

Configure build

Before we configure hugin we need to set the build environment:

export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
export CFLAGS="-I/opt/local/include -L/opt/local/lib"
export CXXFLAGS=$CFLAGS

Configure hugin using cmake from inside the build directory you created:

cmake ../hugin

Compile Hugin

Compile Hugin and friends:

make
sudo make install

Watch the pretty colors go by. Give the dog another quick spin around the block; you're finished. Look for the new bundle Hugin.app in usr/local/Applications/ or in usr/local/bin/. Copy or link it to /Applications, or your preferred location, and commence testing.

Important Note on the produced Bundle

Since the produced Hugin.app bundle links dynamically to libraries outside of the bundle, it is not yet portable, i.e. cannot be copied or shared unless the other machine has the same collection of libraries available in the same places. This is to facilitate development and testing (re-compile external libraries and test without re-building). Building a fully portable universal binary version at the command line is planned. You can use the Build a MacOSX Universal Hugin bundle with Xcode to build a universal portable bundle.

Notes on wxWidgets

Note: wxWidgets 2.6.x is no longer supported. wxWidgets, the GUI toolkit currently employed by Hugin, is currently at version >= 2.8.7.

Jdsmith 23:47, 4 August 2007 (CEST)

Building Enblend (using Fink or MacPorts)

follow these updated instructions

Bulding Autopano-Sift-C

Follow these instructions

Personal tools
Namespaces

Variants
Actions
Navigation
tools
Tools