[ptx] hugin on mac OS X

Bruno Postle bruno at postle.net
Thu Feb 26 15:02:29 GMT 2004


This is how I built hugin on mac OS X 10.1, probably things will
differ for later versions of OS X.

Note: although everything builds, hugin doesn't actually work yet.

Read this document before starting:

    http://fink.sourceforge.net/doc/porting/porting.html

Setting up the build environment
================================

First you need to install the OS X Developer Tools, you either get
this on CD or download from http://developer.apple.com/

You also need various bits of unix software, the Fink project has
lots of unix stuff as well as apt-get (a network-based package
installer) - So install fink:

    http://fink.sourceforge.net/

The default shell on 10.1 is tcsh, start-up a terminal, then switch
to the bash shell and load some sane defaults like so:

    bash
    source /etc/bashrc
    source /sw/bin/init.sh

You can now use apt to install some useful tools:

    sudo apt-get update
    sudo apt-get install  screen vim mutt wget lynx

On 10.1 the default compiler is gcc2, hugin needs gcc3, so you
should change this permanently before you compile anything.

    sudo /usr/sbin/gcc_select 3

Installing required libraries
=============================

Building hugin requires a load of libraries:

    zlib
    libtiff
    libjpeg
    libpng
    fftw
    xfree86-base   (building hugin requires the makedepend tool)
    wxwindows   (with xrc extension)
    panorama-tools
    vigra
    boost

You can install the first few easily using apt:

    sudo apt-get install  libjpeg libpng libtiff zlib xfree86-base fftw

Note that the version of libpng available via fink for 10.1 is
ancient, I had to compile fresh versions of libpng and zlib.

wxWindows
---------

Download wxmac from http://www.wxwidgets.org/

Compile and install like so:

    tar -zxvf wxMac-2.4.2.tar.gz
    cd wxMac-2.4.2
    ./configure
    make
    sudo make install
    cd contrib/src/xrc
    make
    sudo make install

Panorama Tools
--------------

Follow the cvs instructions from here to download libpano:

    http://panotools.sourceforge.net/

I haven't been able to build a fully-loadable pano12 library, but
these instructions more or less work to build something that can be
statically linked:

    http://www.email-lists.org/pipermail/ptx/2004-February/001374.html

Vigra
-----

Get vigra from here:

    http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/

Vigra-1.2.0 has a bug which prevents it from compiling on OS X, I'll
try and remember to attach the patch that fixes it.

Installation goes something like this:

    patch -p1 < vigra-viff.patch

    ./configure --enable-shared=jpeg,png,tiff,zlib,fftw \
                --build=ppc --prefix=/usr/local

    make
    sudo make install

Boost
-----

Download boost from here:

    http://www.boost.org/

Boost has it's own build system called jam, you have to bootstrap it
first:

    cd tools/build/jam_src
    ./build.sh
    cd ../../..

Then build:

    ./tools/build/jam_src/bin.macosxppc/bjam "-sTOOLS=darwin" stage
    sudo ./tools/build/jam_src/bin.macosxppc/bjam "-sTOOLS=darwin" install

I get hundreds of errors during this process; hugin only uses the
boost header template files and they seem to get installed ok, so
you can ignore all the failure messages.

Building hugin
==============

Download hugin following the cvs instructions:

    http://hugin.sourceforge.net/download/

Dependencies
------------

The wxWindows xrc module gets installed with the wrong name, create
a copy with the correct name in the hugin lib directory:

    cp /usr/local/lib/libwx_mac_xrc-2.4.so ./src/lib/libwx_mac_xrc-2.4.dylib

Put a copy of the pano12 library in the same place:

    cp /path/to/libpano/libpano12.a ./src/lib/

Copy the pano12 headers into the hugin tree:

    mkdir src/include/pano12
    cp /path/to/libpano/*.h src/include/pano12/

Edit the configure script and make some changes.  Locate this line:

    $EXTRA_CFLAGS="$EXTRA_CFLAGS -O2";

..and change it to this:

    $EXTRA_CFLAGS="$EXTRA_CFLAGS -O2 -I/sw/include -I/usr/local/include/boost-1_31";

Locate this line:

    $XRC_LFLAGS="-lwx_gtk_xrc-2.4";

..and change it to this:

    $XRC_LFLAGS="-lwx_mac_xrc-2.4";

Other changes
-------------

Apply a patch to fix a bug in panoviewer that stops it compiling:

    patch -p0 < hugin-panoviewer-fix.patch

wxmac doesn't support "toggle buttons", so you can apply this crude
patch that removes a button from hugin:

    patch -p0 < hugin-remove-togglebutton.patch 

Compile hugin
-------------

    ./configure
    make
    cd src/hugin
    ./hugin

That's it, it still doesn't work, but it compiles ok.

-- 
Bruno
-------------- next part --------------
diff -ur vigra1.2.0/src/impex/viff.cxx vigra1.2.0-new/src/impex/viff.cxx
--- vigra1.2.0/src/impex/viff.cxx	Thu Aug  7 01:16:44 2003
+++ vigra1.2.0-new/src/impex/viff.cxx	Wed Feb 25 13:39:05 2004
@@ -611,7 +611,7 @@
     void ViffDecoderImpl::color_map()
     {
         void_vector_base temp_bands;
-        unsigned int temp_num_bands;
+        size_t temp_num_bands;
 
         if ( header.map_storage_type == VFF_MAPTYP_1_BYTE ) {
             typedef unsigned char map_storage_type;
-------------- next part --------------
Index: src/PanoImage/panorama.h
===================================================================
RCS file: /cvsroot/hugin/hugin/src/PanoImage/panorama.h,v
retrieving revision 1.1
diff -u -r1.1 panorama.h
--- src/PanoImage/panorama.h	10 Jul 2003 23:39:50 -0000	1.1
+++ src/PanoImage/panorama.h	26 Feb 2004 14:24:04 -0000
@@ -42,7 +42,7 @@
 
 // Create a definition if we're on a Macintosh:
 #ifndef __Mac__
-	#if (defined(macintosh) || defined(__MC68K__) || defined(__POWERPC__) || defined(__powerc))
+	#if (defined(macintosh) || defined(__MC68K__) )
 		#define __Mac__			1
 		#define BIGENDIAN		1
 	#endif
-------------- next part --------------
Index: src/hugin/PreviewFrame.cpp
===================================================================
RCS file: /cvsroot/hugin/hugin/src/hugin/PreviewFrame.cpp,v
retrieving revision 1.20
diff -u -r1.20 PreviewFrame.cpp
--- src/hugin/PreviewFrame.cpp	15 Feb 2004 14:49:36 -0000	1.20
+++ src/hugin/PreviewFrame.cpp	26 Feb 2004 14:24:05 -0000
@@ -49,7 +49,7 @@
     EVT_TOOL(XRCID("preview_update_tool"), PreviewFrame::OnUpdateButton)
     EVT_TOOL(XRCID("preview_show_all_tool"), PreviewFrame::OnShowAll)
     EVT_TOOL(XRCID("preview_show_none_tool"), PreviewFrame::OnShowNone)
-    EVT_TOGGLEBUTTON(-1, PreviewFrame::OnChangeDisplayedImgs)
+//    EVT_TOGGLEBUTTON(-1, PreviewFrame::OnChangeDisplayedImgs)
     EVT_SCROLL_THUMBRELEASE(PreviewFrame::OnChangeFOV)
     EVT_SCROLL_ENDSCROLL(PreviewFrame::OnChangeFOV)
     EVT_SCROLL_THUMBTRACK(PreviewFrame::OnChangeFOV)
@@ -224,9 +224,9 @@
     // remove items for nonexisting images
     for (int i=nrButtons-1; i>=(int)nrImages; i--)
     {
-        m_ToggleButtonSizer->Remove(m_ToggleButtons[i]);
-        delete m_ToggleButtons[i];
-        m_ToggleButtons.pop_back();
+//        m_ToggleButtonSizer->Remove(m_ToggleButtons[i]);
+//        delete m_ToggleButtons[i];
+//        m_ToggleButtons.pop_back();
         m_displayedImgs.erase(i);
         dirty = true;
     }
@@ -239,27 +239,27 @@
                 unsigned int imgNr = *it;
                 // create new item.
 //                wxImage * bmp = new wxImage(sz.GetWidth(), sz.GetHeight());
-                wxToggleButton * but = new wxToggleButton(this,
-                                                          ID_TOGGLE_BUT + *it,
-                                                          wxString::Format("%d",*it));
+//                wxToggleButton * but = new wxToggleButton(this,
+//                                                          ID_TOGGLE_BUT + *it,
+//                                                          wxString::Format("%d",*it));
                 wxSize sz(9,8);
                 wxSize res = ConvertDialogToPixels(sz);
-                sz = but->GetSize();
-                but->SetSize(res.GetWidth(),sz.GetHeight());
-                but->SetValue(true);
-                m_ToggleButtonSizer->Add(but,
-                                         0,
-                                         wxLEFT,
-                                         5);
+//                sz = but->GetSize();
+//                but->SetSize(res.GetWidth(),sz.GetHeight());
+//                but->SetValue(true);
+//                m_ToggleButtonSizer->Add(but,
+//                                         0,
+//                                         wxLEFT,
+//                                         5);
 
-                m_ToggleButtons.push_back(but);
+//                m_ToggleButtons.push_back(but);
                 m_displayedImgs.insert(imgNr);
                 dirty = true;
             }
         }
     }
     if (dirty) {
-        m_ToggleButtonSizer->Layout();
+//        m_ToggleButtonSizer->Layout();
         DEBUG_DEBUG("ndisplayed: " << m_displayedImgs.size());
         UIntSet copy = m_displayedImgs;
         m_PreviewPanel->SetDisplayedImages(copy);
@@ -360,19 +360,19 @@
 
 void PreviewFrame::OnShowAll(wxCommandEvent & e)
 {
-    DEBUG_ASSERT(m_pano.getNrOfImages() == m_ToggleButtons.size());
+//    DEBUG_ASSERT(m_pano.getNrOfImages() == m_ToggleButtons.size());
     for (unsigned int i=0; i < m_pano.getNrOfImages(); i++) {
         m_displayedImgs.insert(i);
-        m_ToggleButtons[i]->SetValue(true);
+//        m_ToggleButtons[i]->SetValue(true);
     }
     m_PreviewPanel->SetDisplayedImages(m_displayedImgs);
 }
 
 void PreviewFrame::OnShowNone(wxCommandEvent & e)
 {
-    DEBUG_ASSERT(m_pano.getNrOfImages() == m_ToggleButtons.size());
+//    DEBUG_ASSERT(m_pano.getNrOfImages() == m_ToggleButtons.size());
     for (unsigned int i=0; i < m_pano.getNrOfImages(); i++) {
-        m_ToggleButtons[i]->SetValue(false);
+//        m_ToggleButtons[i]->SetValue(false);
     }
     m_displayedImgs.clear();
     m_PreviewPanel->SetDisplayedImages(m_displayedImgs);


More information about the ptX mailing list