Changes between Version 14 and Version 15 of FAQ


Ignore:
Timestamp:
Apr 22, 2007, 10:44:09 AM (17 years ago)
Author:
Mateusz Łoskot
Comment:

Migrated Installation/building section to new page

Legend:

Unmodified
Added
Removed
Modified
  • FAQ

    v14 v15  
    77 5. [wiki:FAQCoordinateSystemsAndProjections]
    88 6. [wiki:FAQMiscellaneous]
    9 
    10 == Installation and Building ==
    11 
    12 === Can I get a MS Visual Studio Project file for GDAL? ===
    13 
    14 The GDAL developers find it more convenient to build with makefiles and the [http://msdn2.microsoft.com/en-us/library/dd9y37ha(vs.80).aspx Visual Studio NMAKE] utility. Maintaining a parallel set of project files for GDAL is too much work, so there are no full project files directly available from the maintainers.
    15 
    16 There are very simple project files available since GDAL/OGR 1.4.0 that just invoke the makefiles for building, but make debugging somewhat more convenient.  These are the makegdal71.sln and makegdal80.sln files in the GDAL root directory.
    17 
    18 Occasionally other users do prepare full project files, and you may be able to get them by asking on the [http://lists.maptools.org/mailman/listinfo/gdal-dev/ gdal-dev list]. However, I would strongly suggest you just use the NMAKE based build system. With debugging enabled you can still debug into GDAL with Visual Studio.
    19 
    20 === Can I build GDAL with MS Visual C++ 2005 Express Edition? ===
    21 
    22 Yes, you can. It's also possible to use GDAL libraries in applications developed using [http://msdn.microsoft.com/vstudio/express/visualc/ Microsoft Visual C++ 2005 Express Edition].
    23 
    24  * Download and install [http://msdn.microsoft.com/vstudio/express/visualc/download/ Visual C++ 2005 Express Edition]. Follow instructions presented on this website:
    25 
    26  * Download and install [http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ Microsoft Platform SDK]. Also, follow these instructions carefully without omitting any of steps presented there:
    27 
    28  * Add following two paths to Include files in the Visual C++ IDE settings. Do it the same way as presented in [http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ Step 3] from the website above.
    29 
    30 {{{
    31 C:\\Program Files\\Microsoft Platform SDK\\Include\\atl
    32 C:\\Program Files\\Microsoft Platform SDK\\Include\\mfc
    33 }}}
    34 
    35  * Since you will build GDAL from command line using nmake tool, you also need to set or update ''INCLUDE'' and ''LIB'' environment variables manually. You can do it in two ways:
    36   1. using the System applet available in the Control Panel
    37   2. by editing vsvars32.bat script located in
    38   {{{
    39   C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat
    40   }}}
    41 
    42  These variables should have following values assigned:
    43 
    44 {{{
    45 INCLUDE=C:\\Program Files\\Microsoft Visual Studio 8\\VC\\Include;
    46         C:\\Program Files\\Microsoft Platform SDK\\Include;
    47         C:\\Program Files\\Microsoft Platform SDK\\Include\\mfc;
    48         C:\\Program Files\\Microsoft Platform SDK\\Include\\atl;%INCLUDE%
    49 
    50 LIB=C:\\Program Files\\Microsoft Visual Studio 8\\VC\\Lib;
    51     C:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\lib;
    52     C:\\Program Files\\Microsoft Platform SDK\\lib;%LIB%
    53 }}}
    54 
    55  '''NOTE:''' If you have edited system-wide ''INCLUDE'' and ''LIB'' variables, using System applet, every Console (cmd.exe) will have it properly set. But if you have edited them through ''vsvars32.bat'' script, you will need to run this script in the Console before every compilation.
    56 
    57  * Patch atlwin.h header
    58 
    59  At line 1725 add int i; declaration, so it looks as follows:
    60 
    61 {{{
    62 BOOL SetChainEntry(DWORD dwChainID, CMessageMap* pObject, DWORD dwMsgMapID = 0)
    63 {
    64     int i;
    65     // first search for an existing entry
    66 
    67     for(i = 0; i < m_aChainEntry.GetSize(); i++)
    68 }}}
    69 
    70  * Patch atlbase.h header
    71 
    72  At line 287, comment ''AllocStdCallThunk'' and ''FreeStdCallThunk'' functions and add macros replacements:
    73 
    74 {{{
    75 /***************************************************
    76 PVOID __stdcall __AllocStdCallThunk(VOID);
    77 VOID __stdcall __FreeStdCallThunk(PVOID);
    78 
    79 #define AllocStdCallThunk() __AllocStdCallThunk()
    80 #define FreeStdCallThunk(p) __FreeStdCallThunk(p)
    81 
    82 #pragma comment(lib, "atlthunk.lib")
    83 ***************************************************/
    84 
    85 /* NEW MACROS */
    86 #define AllocStdCallThunk() HeapAlloc(GetProcessHeap(),0,sizeof(_stdcallthunk))
    87 #define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)
    88 }}}
    89 
    90  * Building GDAL
    91    * Open console windows (Start -> Run -> cmd.exe -> OK)
    92    * If you have edited vsvars32.bat script, you need to run it using full path:
    93    {{{
    94    C:\> "C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools\\vsvars32.bat"
    95    Setting environment for using Microsoft Visual Studio 2005 x86 tools
    96    }}}
    97    * Go do GDAL sources root directory, for example:
    98    {{{
    99    C:\> cd work\gdal
    100    }}}
    101    * Run nmake to compile
    102    {{{
    103    C:\work\gdal> nmake /f makefile.vc
    104    }}}
    105    * If no errors occur, after a few minutes you should see GDAL libraries in C:\work\gdal.
    106 
    107 Now, you can use these libraries in your applications developed using Visual C++ 2005 Express Edition.
    108 
    109 === Can I build GDAL with Cygwin or MinGW? ===
    110 
    111 GDAL should build with [http://www.cygwin.com/ Cygwin] using the Unix-like style build methodology. It is also possible to build with [http://www.mingw.org/ MinGW] though there are some complications. The following might work:
    112 
    113 {{{
    114 ./configure --prefix=$PATH_TO_MINGW_ROOT --host=mingw32 \
    115         --without-libtool --without-python $YOUR_CONFIG_OPTIONS
    116 }}}
    117 
    118 Using external win32 libraries will often be problematic with either of these environments - at the least requiring some manual hacking of the GDALmake.opt file.
    119 
    120 === Can I build GDAL with Borland C or other C compilers? ===
    121 
    122 These are not supported compilers for GDAL; however, GDAL is mostly pretty generic, so if you are willing to take on the onerous task of building an appropriate makefile / project file it should be possible. You will find most portability issues in the [http://www.gdal.org/cpl__port_8h.html gdal/port/cpl_port.h] file and you will need to prepare a [http://www.gdal.org/cpl__config_8h-source.html gdal/port/cpl_config.h] file appropriate to your platform. Using [http://trac.osgeo.org/gdal/browser/trunk/gdal/port/cpl_config.h.vc cpl_config.h.vc] as a guide may be useful.
    1239
    12410== Raster Support ==