[转]使用MinGW编译GDAL的方法

原帖地址:http://bbs.osgchina.org/forum.php?mod=viewthread&tid=893

1、安装MinGW(tdm-mingw-1.812.0-f1.exe)、MSys(MSYS-1.0.10.exe)
2、解压gdal160.zip(假定将gdal160.zip解压到了D:\gdal160中)
3、打开MSys命令行,进入GDAL目录,如: cd /d/gdal160
4、./configure --prefix=/d/GDAL (该参数指定第6步中的安装路径)
5、make
      如果在链接时出现找不到“/d/gdal160/frmts/o/.libs/EnvisatFile.o”的错误,打开GNUmakefile文件修 改 6-12 行,用 . (英文句点)替换这几行中的“$(GDAL_ROOT)”,再执行make。也可以在执行make之前先对GNUmakefile文件进行上述修改后,再 执行make。
6、make install
7、make docs(可选,自动调用Doxygen生成html文档,必须先安装Doxygen)
8、make install-docs(可选,将上一步生成的文档拷贝到第4步指定的安装路径的doc文件夹中)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
注:如需生成python库,可以在configure时加--with-python参数,如“./configure --with-python”。也可以在/d/gdal160/swig/python下依次执行“setup.py build”和“setup.py install”。但在make时出现如下错误:
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

你可能感兴趣的:(MinGW)