Monday, March 11, 2013

Build 64 bit GDAL for Windows

In building libLAS from source, there is the option of linking it with GDAL. Since I was interested in making 64 bit Windows version of libLAS, I had to find or make my own 64 bit versions of GDAL. Eventually, I decided to build my own. The following are the steps I did to compile 64 bit GDAL on Microsoft Visual Studio 2010. Note that the 64 bit executables may not run successfully depending on the source code even if the compilation is successful.
  1. Download the latest GDAL source code from http://download.osgeo.org/gdal/. Extract the files into a folder e.g. C:\Work\src\gdal-1.9.2\.
  2. On the Windows Desktop, select Start | All Programs | Microsoft Visual Studio 2010 | Visual Studio Tools | Visual Studio x64 Win64 Command Prompt.

    The Visual Studio x64 Win64 Command Prompt appears.
  3. In the Command Prompt, change directory to the extracted GDAL source code root folder.

    C:\> cd \Work\src\gdal-1.9.2
  4. Build the GDAL 64 bit Windows binaries with the nmake command.

    C:\> nmake /f makefile.vc MSVC_VER=1600 WIN64=YES

    The binaries are generated.

2 comments:

Unknown said...

Thank you!

Your nmake command works like a charm for Visual Studio 2012 as well. With one minor modification:
C:\> nmake /f makefile.vc MSVC_VER=1700 WIN64=YES

The generated gdal110.dll and its import library gdal_i.lib work well.

Amir said...

I followed the same procedure for visual studio 2010. but when I try to write script "import gdal", "gdal in not appearing"

Please let me whether I have to copy generated dll to some folder of VS 2010

Please help.