How do I build Exiv2 on the XYZ platform?

Exiv2 is developed on GNU/Linux with recent versions of GCC. Written in C++, it uses the standard C++ library, C++ exceptions and a few POSIX and C functions and is portable to many platforms and compilers.

The "distribution":[[]] includes standard build files for UNIX-like systems (including GNU/Linux, Mac OS X, Cygwin and MinGW) as well as Visual Studio project files for msvc2005 and later (2008/10/12/13/15). We also provide msvc2003 support. CMake support is provided on all supported platforms (see README-CMAKE). CMake/MSVC support is in contrib/cmake/msvc

We actively build and run our test suite on the following platforms (32/64 bit builds of both static and dynamic libraries):

  1. Mac OS-X (clang compiler)
  2. Linux (GCC compiler)
  3. Cygwin (GCC compiler)
  4. MinGW (GCC compiler)
  5. Visual Studio (cl compiler)

We currently do not support mobile platforms such as iOS, Android and WinCE although we believe the code can be successfully built for those platforms. Additionally, we believe Exiv2 can be built for embedded platforms with or without an operating system.

For Autotools on Unix systems (Mac/Linux/Cygwin/MinGW), the normal build command-set is:

$ cd <exiv2-dir>
$ make config
$ ./configure
$ make                                      # make CXXFLAGS=-ggdb for debug
$ sudo make install
*** TAKE CARE: You need the utility pkg-config to build samples AND the following environment variable ***
$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/opt/local/lib/pkgconfig" 
$ make samples
*** TAKE CARE: You must build the samples to run the tests ***
$ make tests
*** TAKE CARE: You need the test directory to run the tests (see below) ***
To list options for the configure script use ./configure --help

For CMake on Unix systems (see <exiv2-dir>README-CMAKE for details and information about CMake/Visual Studio)

$ cd <exiv2-dir>
$ mkdir ../build
$ cd    ../build
$ cmake --help                              # to get a list of "generators" on your machine.
$ cmake -G "Unix Makefiles" ../<exiv2-dir>  # -DCMAKE_BUILD_TYPE=Debug     for debugging
$ make                                      # builds exiv2 samples
$ make tests
$ sudo make install (if you wish to install)
You may specify build options on the command-line:
$ cmake ../<exiv2-dir> -DEXIV2_ENABLE_SSH=OFF
$ grep ^OPTION ../<exiv2-dir>/CMakeLists.txt # To list the options
OPTION( EXIV2_ENABLE_SHARED        "Build exiv2 as a shared library (dll)"                 ON  )
OPTION( EXIV2_ENABLE_XMP           "Build with XMP metadata support"                       ON  )
OPTION( EXIV2_ENABLE_LIBXMP        "Build a static convenience Library for XMP"            ON  )
OPTION( EXIV2_ENABLE_VIDEO         "Build with video support"                              OFF )
OPTION( EXIV2_ENABLE_PNG           "Build with png support (requires libz)"                ON  )
OPTION( EXIV2_ENABLE_NLS           "Build native language support (requires gettext)"      ON  )
OPTION( EXIV2_ENABLE_PRINTUCS2     "Build with Printucs2"                                  ON  )
OPTION( EXIV2_ENABLE_LENSDATA      "Build including lens data"                             ON  )
OPTION( EXIV2_ENABLE_BUILD_SAMPLES "Build the unit tests"                                  ON  )
OPTION( EXIV2_ENABLE_BUILD_PO      "Build translations files"                              OFF )
OPTION( EXIV2_ENABLE_VIDEO         "Build video support into library"                      OFF )
OPTION( EXIV2_ENABLE_WEBREADY      "Build webready support into library"                   OFF )
OPTION( EXIV2_ENABLE_CURL          "USE Libcurl for HttpIo"                                ON  )
OPTION( EXIV2_ENABLE_SSH           "USE Libssh for SshIo"                                  ON  )
OPTION( EXIV2_ENABLE_WIN_UNICODE   "Use Unicode paths (wstring) on Windows"                OFF )
For Visual Studio on Windows, a robust environment is provided for building static/dynamic/debug/release/32/64 bit builds of the libraries and all sample applications.
Visual Studio support is provided in 2 flavors:
msvc:     for 32 bit and 64 bit builds with Visual Studio 2005/8/10/12/13/15   More details: <exiv2-dir>/msvc/ReadMe.txt
msvc2003: for 32 bit builds with Visual Studio 2003                            More details: <exiv2-dir>/msvc2003/README-MSVC.txt
For Unix/Mac/Linux users of Eclipse or QtCreator or Xcode or other tools, use CMake and the appropriate generator (-G option). Use cmake --help for more information about available generators on your system.

The test directory

If you have checked out exiv2 source from svn (from trunk, branch, tag) you will have the test directory. If you are building from the release bundle (.tar.gz) you will need to download these directly from the repository (about 34 MB). For example when using exiv2-0.25.tar.gz:

$ cd <exiv2dir>
$ svn export svn://

Build/Platform Summary

A concise table for various platforms:

Platform/Compiler GCC Clang MSVC
Linux Fedora AutoMake
Fedora CMake
Ubuntu AutoMake
Ubuntu CMake
Windows (MinGW) Win7 AutoMake N/A
Windows (CygWin) Win7 CMake & AutoMake N/A
Windows (Visual Studio) N/A N/A Win7 Visual Studio 2012
Using CMake with MSVC
Mac OSX Mac OSX AutoMake
Mac OSX CMake

Additional Build Notes

The following are additional resources on the topic:

If you have additional links, suggestions or requests, we'll be happy to hear from you.

Robin Mills
Nehal J Wani

Back to the FAQ

Redmine Appliance - Powered by TurnKey Linux