Difference between revisions of "Build pano12 from sourcecode"

From PanoTools.org Wiki
Jump to: navigation, search
m (forwardslash should be windows backslash)
(reworded first paragraph so that when people search for compile they find this page too)
 
(13 intermediate revisions by 4 users not shown)
Line 2: Line 2:
  
 
I'm no Windows expert, this tutorial is the first time I used these tools to
 
I'm no Windows expert, this tutorial is the first time I used these tools to
build software, so if I can do it, so can you.
+
build software, so if I can do it, so can you compile the panotools.
  
 
The purpose of this exercise is to roll your own version of the [[pano12|pano12
 
The purpose of this exercise is to roll your own version of the [[pano12|pano12
Line 27: Line 27:
  
 
First you need panorama tools itself, so
 
First you need panorama tools itself, so
[http://sourceforge.net/project/showfiles.php?group_id=96188 download pano12
+
[http://sourceforge.net/project/showfiles.php?group_id=96188 download pano12 sourcecode],
sourcecode], I downloaded '''libpano12-2.7.0.10.zip'''. You can view the source documentation for pano12.dll [http://www.panotools.info/members/documentation/pano12/index.html HERE].
+
I downloaded '''libpano12-2.7.0.10.zip'''.  
  
 
You also need the sourcecode for the various libraries required by pano12,
 
You also need the sourcecode for the various libraries required by pano12,
 
these are [http://www.zlib.net/ zlib],
 
these are [http://www.zlib.net/ zlib],
[http://www.libpng.org/pub/png/libpng.html libpng], [http://www.ijg.org/
+
[http://www.libpng.org/pub/png/libpng.html libpng], [http://www.ijg.org/ libjpeg]
libjpeg] and [http://www.libtiff.org/ libtiff].  There is no longer any need to
+
and [http://www.libtiff.org/ libtiff].  There is no longer any need to
 
download the Java development kit as MinGW now includes a Free version.
 
download the Java development kit as MinGW now includes a Free version.
  
 
I downloaded '''zlib123.zip''', '''lpng128.zip''', '''jpegsr6.zip''' and
 
I downloaded '''zlib123.zip''', '''lpng128.zip''', '''jpegsr6.zip''' and
'''tiff-3.7.4.zip''' (I would normally download the ''.tar.gz'' versions, but
+
'''tiff-v3.5.7.zip''' (I would normally download the ''.tar.gz'' versions, but
 
Windows seems to have some kind of ''.zip'' extractor built-in so I thought I'd
 
Windows seems to have some kind of ''.zip'' extractor built-in so I thought I'd
try that).
+
try that).  Note that I had trouble with a later version of libtiff, tiff-v3.5.7
 +
is the one that worked for me.
  
 
Extract the files into directories called '''libpano12''', '''zlib''', '''libpng''',
 
Extract the files into directories called '''libpano12''', '''zlib''', '''libpng''',
 
'''libjpeg''' and '''libtiff'''.
 
'''libjpeg''' and '''libtiff'''.
 +
 +
If you want to create LZW compressed [[TIFF]] files with [[PTmender]], then download
 +
'''libtiff-lzw-compression-kit-1.5.tar.gz''', extract the tif_lzw.c file and
 +
overwrite the one supplied in this old version of libtiff.
  
 
The default MSYS ''home'' on this system is '''C:\msys\1.0\home\Bruno''',
 
The default MSYS ''home'' on this system is '''C:\msys\1.0\home\Bruno''',
Line 73: Line 78:
 
   make
 
   make
 
   cp png.h /usr/local/include
 
   cp png.h /usr/local/include
   cp pngconf.h /usr/local/lib
+
   cp pngconf.h /usr/local/include
 
   cp libpng.a /usr/local/lib
 
   cp libpng.a /usr/local/lib
 
   cd
 
   cd
Line 90: Line 95:
  
 
   cd libtiff
 
   cd libtiff
   ./configure --disable-shared
+
   ./configure
 
   make
 
   make
   make install
+
   cp libtiff/*.h /usr/local/include
 +
  cp libtiff/*.a /usr/local/lib
 
   cd
 
   cd
 
For some reason, the libtiff.la file prevents pano12 from linking properly, so
 
delete it:
 
 
  rm /usr/local/lib/libtiff.la
 
  
 
=== Build libpano12 ===
 
=== Build libpano12 ===
Line 112: Line 113:
 
   C:\msys\1.0\local\bin
 
   C:\msys\1.0\local\bin
  
Look for '''[[PTOptimizer|PTOptimizer.exe]]''', '''[[pano12|pano12.dll]]''' and
+
Look for '''[[PTOptimizer|PTOptimizer.exe]]''', '''[[pano12|pano12.dll]]''',
'''[[panoinfo|panoinfo.exe]]'''.
+
'''[[panoinfo|panoinfo.exe]]''', '''[[PTmender|PTmender.exe]]''' and
 +
'''[[PTblender|PTblender.exe]]'''.
  
 
== Finishing up ==
 
== Finishing up ==
Line 122: Line 124:
 
   strip /usr/local/bin/pano12.dll
 
   strip /usr/local/bin/pano12.dll
 
   strip /usr/local/bin/panoinfo.exe
 
   strip /usr/local/bin/panoinfo.exe
   strip /usr/local/bin/PTOptimizer.exe
+
   etc...
  
 
Now just copy them to whichever location they are needed to run your
 
Now just copy them to whichever location they are needed to run your
Line 143: Line 145:
 
You will need a decent text editor to change sourcecode, Notepad or Word ''will not do''.
 
You will need a decent text editor to change sourcecode, Notepad or Word ''will not do''.
  
=== Getting the latest CVS version ===
+
[[Category:Tutorial:Nice to know]]
 
+
CVS is a source-code management system that allows multiple users to share the
+
same set of files online.
+
 
+
You need a CVS client in order to ''checkout'' the code, so
+
[http://www.mingw.org/download.shtml Download the MSYS Developers Toolkit] which is part of MinGW
+
(I grabbed the '''msysDTK-1.0.1.exe''' installer).
+
 
+
Instructions for getting the code are on the [http://panotools.sourceforge.net
+
panotools sourceforge site], but it is usually as simple as typing this into the shell:
+
 
+
  cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/panotools login
+
  cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/panotools co libpano
+
 
+
(Hit enter when asked for a password)
+
 
+
This will create a directory containing the latest code called '''libpano''' (which you may rename).
+

Latest revision as of 18:07, 21 March 2007

Building PANO12.DLL for Windows

I'm no Windows expert, this tutorial is the first time I used these tools to build software, so if I can do it, so can you compile the panotools.

The purpose of this exercise is to roll your own version of the pano12 Panorama Tools library. You might want to do this for fun, to play with extending the code, fixing bugs or simply to remove the Field of View restrictions on fisheye input images.

Set-up the build environment

To start you need a Free C compiler and associated tools, so Download MinGW and MSYS. I grabbed the "Windows Installer" versions: MinGW-4.1.1.exe and MSYS-1.0.10.exe.

The first one is the "Minimalist Gnu for Windows", it provides a win32 version of the GNU compiler and related tools.

The second is a "Minimal SYStem", this provides a POSIX environment. Answer yes to the questions and enter the directory where you installed MinGW when asked:

 C:\MinGW

Download the source-code

First you need panorama tools itself, so download pano12 sourcecode, I downloaded libpano12-2.7.0.10.zip.

You also need the sourcecode for the various libraries required by pano12, these are zlib, libpng, libjpeg and libtiff. There is no longer any need to download the Java development kit as MinGW now includes a Free version.

I downloaded zlib123.zip, lpng128.zip, jpegsr6.zip and tiff-v3.5.7.zip (I would normally download the .tar.gz versions, but Windows seems to have some kind of .zip extractor built-in so I thought I'd try that). Note that I had trouble with a later version of libtiff, tiff-v3.5.7 is the one that worked for me.

Extract the files into directories called libpano12, zlib, libpng, libjpeg and libtiff.

If you want to create LZW compressed TIFF files with PTmender, then download libtiff-lzw-compression-kit-1.5.tar.gz, extract the tif_lzw.c file and overwrite the one supplied in this old version of libtiff.

The default MSYS home on this system is C:\msys\1.0\home\Bruno, so I put these directories in there.

Build everything

Double-click MSYS and you should get a small window with a command-line, this is a POSIX shell.

The following commands need to be typed into the shell. If you make a mistake, just type cd to return to your home and try again.

Compilation results in lots of text scrolling very fast up the screen, ignore any warnings, but error messages will give you a clue when things are not working properly.

Build zlib

 cd zlib
 ./configure
 make
 make install
 cd

Build libpng

 cd libpng
 cp scripts/makefile.gcc Makefile
 make
 cp png.h /usr/local/include
 cp pngconf.h /usr/local/include
 cp libpng.a /usr/local/lib
 cd

Build libjpeg

 cd libjpeg
 ./configure
 make
 make install
 make install-lib
 make install-headers
 cd

Build libtiff

 cd libtiff
 ./configure
 make
 cp libtiff/*.h /usr/local/include
 cp libtiff/*.a /usr/local/lib
 cd

Build libpano12

 cd libpano12
 ./configure
 make
 make install
 cd

This final step will create the binaries in this directory:

 C:\msys\1.0\local\bin

Look for PTOptimizer.exe, pano12.dll, panoinfo.exe, PTmender.exe and PTblender.exe.

Finishing up

The files can be stripped to remove unused symbols - This isn't necessary, but it does make them smaller:

 strip /usr/local/bin/pano12.dll
 strip /usr/local/bin/panoinfo.exe
 etc...

Now just copy them to whichever location they are needed to run your application.

Further tasks

Of course, the reason you are rolling your own is in order to make modifications or to try out the latest code, so here are some suggestions:

Increasing the fisheye field-of-view restriction

This is the MAX_FISHEYE_FOV constant in the filter.h file (which defaults to 160 degrees), increase it to something larger like 720. Then rebuild the library:

 make
 make install

You will need a decent text editor to change sourcecode, Notepad or Word will not do.