LibRaw is distributed in the form of source codes. For further use, they should be compiled (and, if desired, placed into system folders with libraries and include-files).
Unix Systems (FreeBSD, Linux, Mac OS X)
To build the library, you will need a working C++ compiler (gcc ver. 3.x or 4.x will be OK; other compilers have not been tested) and the make utility. No other libraries or utilities are required.
LibRaw has been tested on 32- and 64-bit Unix systems working on x86- (and AMD64-) compatible processors. Building and work on other architectures have not been tested.
Compilation of Library and Examples
Unpack the downloaded distribution package. If you wish to use LibRaw-demosaic-pack(s), unpack these archives too:
tar xzvf LibRaw-X.YY.tar.gz tar xzvf LibRaw-demosaic-pack-GPL2-X.YY.tar.gz tar xzvf LibRaw-demosaic-pack-GPL3-X.YY.tar.gz tar xzvf LibRaw-X.YY.tar.gz
Go to LibRaw directory and run ./configure and make:
cd LibRaw-X.YY ./configure # with optional args make
As a result, you will compile
- Library libraw.a in the lib/ folder
- Examples in the bin/ folder (source codes of examples are in the samples/ folder).
In the current version, only static libraries are built:
- libraw.a: non-thread-safe version
- libraw_r.a: thread-safe
./configure script have some non-standard parameters:
- Enable/disable OpenMP support if compiler supports it. OpenMP is enabled by default.
- Enable/disable LCMS color engine support. If enabled, ./configure will try to find lcms library. Both LCMS-1.x and LCMS-2.x are supported LCMS support is enabled by default
- Enables/disables examples compilation and installation. Enabled by default
Enables/disables support of additional demosaic methods licensed under GPL2
You need to download and unpack LibRaw-demosaic-pack-GPL2 archive to use
./configure will try to find demosaic pack in:
- If folder is specified via --enable-demosaic-pack-gpl2=FOLDERNAME command-line option, then only this folder will be checked.
- If no folder is specified in --enable-demosaic-pack-gpl2 switch:
- ./LibRaw-demosaic-pack-GPL2 (in LibRaw folder)
- ../LibRaw-demosaic-pack*GPL2* - upper level folder
- Same as above, but for GPL3-licensed demosaic pack.
Installation and Usage
To install the library, run
sudo make install
It will place the libraries in /usr/local/lib, the include-files in /usr/local/include (subfolder of
libraw) and LibRaw samples to /usr/local/bin. You can override installation path by using
To use LibRaw, add the following parameters to the compiler call (when building your own projects):
- Path to include-files: -I/usr/local/include
- Path to libraries: -L/usr/local/lib
- Library: -lraw (ordinary version) or -lraw_r (thread-safe version).
Windows: Building under Cygwin
Building and installation are completely similar to building and installation under Unix systems.
Windows: Native Building
Building under Windows has three steps:
- Unpack the distribution package (if you have got no tar+gzip, take the LibRaw distribution package in the .ZIP format) and go to folder LibRaw-X.YYY.
- Set the environment parameters so that the compiler/linker would find the libraries and include-files. For Visual C++, this is done by running vcvars32.bat.
nmake -f Makefile.msvc
If all paths are set correctly and the include-files/libraries have been found, then the following will be compiled:
- Library libraw_static.lib in folder lib
- Dynamic library bin/libraw.dll and linking library for it lib/libraw.lib
- Examples in folder bin/.
Only the thread-safe library is built under Win32, but it can be used with non-threaded applications as well. All examples are linked with the dynamic library (DLL); if static linking is necessary, one should link applications with library libraw_static.lib and set the preprocessor option /DLIBRAW_NODLL during compilation.
Windows-version compiles without LCMS support for now.
During building of DLL, all public functions are exported; further, the exported subset may be reduced.
Unfortunately, paths to include/ libraries depend on the way Visual C (or other compiler) is installed; therefore, it is impossible to specify some standard paths in Makefile.msvc.
No installation under Windows is supported. It is assumed that all DLLs will be supplied together with the software using them (and this software will perform the installation). Accordingly, in building of programs using LibRaw, the paths to libraries, DLLs, and include-files should be specified manually.