The JasPer library can be used for JPEG2000 access in GDAL.

Building with JasPer

JPEG2000 support based on JasPer toolkit which can be accessed from the JasPer Project Home Page.

JasPer itself is a bridge for working with several image file formats. Only JP2 and JPC parts of JasPer used in GDAL.

You need modified JasPer library to build this driver with GeoJP2 support enabled. Modified version can be downloaded from

On 64bit linux systems it may be necessary to force use of -fPIC when building JasPer or else it can't be used in the GDAL shared library.

  export CFLAGS="-O2 -fPIC"


If may encounter following error during linking, especially when building GDAL on Mac OS X:

ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_magctxnolut (size 16384)
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_mqctxs (size 160)
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_refnmsedec (size 512)
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_refnmsedec0 (size 512)
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_scctxnolut (size 1024)
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_signmsedec (size 512)
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_signmsedec0 (size 512)
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_spblut (size 1024)
/usr/local/lib/libjasper.a(jpc_t1cod.o) definition of common _jpc_zcctxnolut (size 4096)
/usr/bin/libtool: internal link edit command failed
make[1]: *** [/Users/mloskot/dev/gdal/_svn/trunk/gdal/libgdal.dylib] Error 1
make: *** [check-lib] Error 2

In order to fix it, it's required to rebuild JasPer with additional compilation option:

$ export CFLAGS="-fno-common"
$ ./configure
make clean
make install

After new build of JasPer is installed, GDAL should compile and link with success.

Known issues

You might encounter crashes when using the Jasper JPEG2000 driver with some particular versions of libjasper packaged by Debian (or Debian-based distribution). See Debian jasper 1.900.1-6 was known to be buggy, but 1.900.1-6-1 is fixed now. At the time of writing, Ubuntu 9.10 using jasper 1.900.1-6 is affected (see Ubuntu 10.04 (dev) using 1.900.1-6-1 should be unaffected.

Open Tickets

No results

Last modified 13 years ago Last modified on Jan 9, 2010, 7:48:37 AM
Note: See TracWiki for help on using the wiki.