Windows Build

From OTBWiki
Jump to: navigation, search

If you want develop into OTB, we highly recommend to made it with Linux platform.

Currently it is not possible to build OTB in Debug based on the OSGeo4W package. If you want build OTB in Debug for Windows, you need to install manually each dependences needed by OTB (good luck...). Its also offers the possibility to use some other compilers.

This page is dedicated to people who want to install OTB on Windows to made their own developments based on it.

Install the latest release of OTB for Windows

No OTB standalone installer are provided for Windows, you must build the library from source and install it.

Build OTB under Windows OS to install the library and use it into your developments is currently more challenging than under Linux OS. Therefore we advice to the beginners to go under Linux. For example, we provide OTB packages for Ubuntu. With these, you can easily test and discover OTB functionalities. Please go to section 2.1.3 of the SoftwareGuide.

We will describe here how to install the library with the typical functionalities in Release mode.

Preliminary Steps

To build OTB library under windows the followings conditions are mandatory:

  • have a Windows version supported: XP SP3 and Seven (these two versions are currently tested)
  • have a Windows compiler supported: Microsoft Visual Studio C++ 2010 (Express or Complete version)

You need also to install the following tool to configure and generate the Visual Studio solution of OTB (OTB.sln) and all the visual studio projects:

  • CMake: version >= 2.8.6 (the latest binary for windows is here)

To manage correctly and easily the dependences of OTB under Windows we strongly recommend to install OSGeo4W tool. This software will provide you all the necessary dependences. Please follow the following steps:

  1. download the setup installer
  2. select the Advanced Install
  3. select Install from Internet
  4. keep as much as possible the default value about root directory and other parameters. You must have the write access to this root directory.
  5. in the next screen, select a local package directory (idem you must have the write access to this directory)
  6. select your Internet connection settings
  7. select the following packages:
    • gdal
  8. run the installation process

Create a repository (with write access) where store your work (for example at C:\path\to\MyORBDir). Organize your repository as it :

  • MyOTBDir\src
  • MyOTBDir\build
  • MyOTBDir\install

Retrieve the latest release of OTB: currently 3.16 (you can find the latest source here) and unzip it into the previous src directory.

Configure the OTB solution for Visual Studio

Open a OSGeo4W shell, run the cmake-gui command and follow the following steps:

  1. indicate where are your source (should be C:\path\to\MyORBDir\src)
  2. indicate where to build the source (should be C:\path\to\MyORBDir\build)
  3. run configure
  4. select the appropriate generator ( it should be Visual Studio 10)
  5. run the first configuration pass
  6. you should encounter an error with FLTK, please set the variable OTB_USE_EXTERNAL_FLTK to OFF
  7. CMake should now configure correctly the project
  8. (optional) If you want get some examples to discover the library, you should activate the examples. Therefore set the BUIL_EXAMPLES variable to ON.
  9. If you are interesting by only use OTB into your developments, you should configure only the Release mode. Therefore set the CMAKE_CONFIGURATION_TYPES variable to Release
  10. run again the configure

If CMake indicate that the configuration is done correctly, you can generate the visual studio solution with Generate button. You can verify that you find into you build directory (should be C:\path\to\MyORBDir\build) the OTB.sln file.

Build the OTB library

Open a OSGeo4W shell and run the following commands:

  • set the language used by the compiler:
set LANG=C
  • if you have used the standard OSGeo4W directory, you should run to set the correct environment (otherwise used the right path to o4w_env.bat):
call "C:\OSGeo4W\bin\o4w_env.bat"
  • (optional) if you have install the otb-bin package from OSGeo4W, you need to reset the following variables to avoid conflicts during the build
  • move to to your build directory
cd C:\path\to\MyORBDir\build
  • open the solution into to the OSGeo4W shell: write OTB.sln and push enter
  • build the OTB solution in Release. Remarks: it could be long.
  • (optional) in the OSGeo4W shell, move to the bin/Release directory into the build directory and run the Helloworld.exe example.
  • build the INSTALL project in Release.
  • you should now have all the OTB install in your install directory (should be C:\path\to\MyORBDir\install).


The Prose Version

The main external dependencies to Orfeo on Windows is GDAL. Download prebuilt binaries and headers as appropriate. They are provided by OSGeo4W.

Detailed instructions are available in the OTB Software Guide

Quick start instructions are given for the most common operating systems in the FAQ

Not using the recommended way of getting the dependencies on Windows is still possible, but is left at the user's discretion

FLTK is required for windowing and some GUI demos depend on it. This is included in the OTB repository and not needed separately.

Choose to generate appropriate MSVC project from CMake e.g. Visual Studio 9 2008 for MSVC 2008 Express. Open the project entitled ALL_BUILD and compile it to build the OTB source.

Step-by-step Instructions

  1. Install TortoiseHG, MSVC Express, Osgeo4w, CMake
    • TortoiseHG - lets you check out the latest code
    • MSVC Express - Lets you compile the source
    • Osgeo4w - provides dependency libraries for OTB
    • CMake - lets you configure the compile system
  2. Configure the OTB code with CMAKE for building
  3. Open the solution produced with MSVC and compile/install.
  4. Repeat configure with cmake/compile with MSVC for Monteverdi
  5. Run otb/monteverdi from where ever they were installed.

Again, please also check instructions given in the OTB Software Guide and the FAQ. If none of them solves your problem, you can send a mail to the otb-users mailing list.

Other issues

You can also have a look at other Windows issues.