wiki:JP2KAK

Version 8 (modified by Mateusz Łoskot, 17 years ago) ( diff )

--

JP2KAK is the Kakadu based GDAL Driver for JPEG2000 image data. There are several other JPEG2000 drivers as well (JPEG200 - JasPer, JP2MRSID - MrSID SDK, JP2ECW - ECW SDK). The Kakadu library is proprietary, but can be licensed under reasonable terms for various uses. Unfortunately it comes with a slightly unusual build system which makes it hard to build against.

Building Kakadu on Unix/Linux

The following guide walks through steps required to build Kakadu 6.0 and GDAL with JP2KAK driver support on 32-bit Linux machine. Instructions presented here have been tested under Ubuntu Linux.

  • Prerequisites

You have obtained Kakadu source code and license in version 6.0.

  • Unpack Kakadu 6.0 sources to preferred location
$ cp v6_0-00256n.zip /usr/local
$ cd /usr/local
$ unzip v6_0-00256n.zip
$ mv v6_0-00256N kakadu-6.0

Note: I assume you have sufficient privileges to operate in /usr/local directory or you have chosen different location.

The location /usr/local/kakadu-6.0 will be used as building workspace and also as installation directory, because there is no make install step when building Kakadu.

$ cd /usr/local/kakadu-6.0
  • Build subtree coresys
$ cd coresys/make
$ make -f Makefile-Linux-x86-32-gcc 
$ cd ../..
  • Build subtree apps
cd apps/make
$ make -f Makefile-Linux-x86-32-gcc 
$ cd ../..
  • Copy libraries to location where GDAL expects to find them
$ pwd
/usr/local/kakadu-6.0
$ mv lib/Linux-x86-32-gcc/* lib/

After this step, Kakadu libraries can be found here:

$ cd /usr/local/kakadu-6.0/lib
$ ls lib*
libkdu.a  libkdu_stacksafe32.a  libkdu_v60R.so

Building GDAL with Kakadu support

  • Configuration
$ ./configure --with-kakadu=/usr/local/kakadu-6.0

As you see, --with-kakadu option takes root (prefix) of Kakadu installation directory. As mentioned in the previous section, GDAL building scripts will look for Kakadu binaries in subdirectory /usr/local/kakadu-6.0/lib.

Verify if ./configure successfully detected Kakadu files:

...
GDAL is now configured for i686-pc-linux-gnu

  Installation directory:    /home/mloskot/usr
  C compiler:                gcc -O2 
  C++ compiler:              g++ -O2 

  LIBTOOL support:           no

...
  KAKADU support:            yes
...
  • Build GDAL with JP2KAK driver
$ make

Unix/Linux Builds by Frank

This is how I setup to use Kakadu 6.0 on my 64bit linux system with GDAL 1.4.x. Other makefiles exist for 32bit linux and a few other variations. You may have to fiddle with the makefiles some if your environment is odd.

(this is in progress - my build with v6 isn't actually working yet)

unzip v6_0-00256n.zip 
mv v6_0-00256N kakadu-6.0
cd kakadu-6.0/coresys/make
make -f Makefile-Linux-x86-64-gcc
cd ../../
cp lib/Linux-x86-64-gcc/* /usr/local/lib
cd apps/make

Edit to add -fPIC in compile options.

make -f Makefile-Linux-x86-64-gcc

Then I configure GDAL like this:

./configure --with-kakadu=/home/warmerda/pkg/kakadu-6.0

and build. The Kakadu libraries are used as static libraries, so there are no .so's to carry along.

Note: See TracWiki for help on using the wiki.