LIUNX-Centos 7 编译GDAL

一、准备工作

安装编译环境

 sudo yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel

 注意:如果嫌麻烦的话,那就直接yum groupinstall "Development tools” 

二、安装GDAL

 1.安装依赖环境

 1.1 安装PROJ.4

 wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz

 mkdir gdal

 tar -zxf proj-4.9.3.tar.gz -C gdal/

 cd gdal/proj-4.9.3/

 ./configure

 sudo make && make install

 

安装问题:

 cannot create regular file '/usr/local/lib/libproj.so.12.0.0': Permission denied

 

解决:

 chown -R kylin:kylin /uer/local/lib

 

重新指向安装

./configure --prefix=/apps/app/gdal/proj-4.9.3/ 

 

sudo make && make install

 

环境变量:

 

export PROJ_HOME=/apps/app/gdal/proj-4.9.3

 

$PROJ_HOME/bin

 

检验安装:

 

proj —help 

 

 

 1.2 安装GESO

wget http://download.osgeo.org/geos/geos-3.6.2.tar.bz2

 

bz2 解压支持安装:

 

sudo yum -y install bzip2 

 

tar xjf geos-3.6.2.tar.bz2

 

cd geos-3.6.2

 

./configure

 

sudo -

 

make 

 

make install

 

经试验,这个还是root用户安装

 

 

 

 

1.3 安装SWIG

 

 

 

wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz

 

tar -zxf swig-3.0.12.tar.gz

 

cd swig-3.0.12

 

./configure

 

make

 

make install

 

检验安装

 

swig -help

 

 

1.3 安装GDAL

 

wget http://download.osgeo.org/gdal/2.2.0/gdal-2.2.0.tar.gz

 

tar -zxf gdal-2.2.0.tar.gz

 

cd gdal-2.2.0

 

./configure —with-java=/apps/app/dk/jdk1.7.0_79/

 

make

 

编译时间很长

 

make install

 

cd swig/java/

 

vim java.opt

 

make

 

 

编译报错:make: ant: Command not found

 

ANT 安装:

 

wget http://mirror.bit.edu.cn/apache//ant/binaries/apache-ant-1.9.9-bin.tar.gz

 

tar -zxf apache-ant-1.9.9-bin.tar.gz

 

cd apache-ant-1.9.9

 

vim /etc/profile

 

source /etc/profile

 

ant -version

 

Apache Ant(TM) version 1.9.9 compiled on February 2 2017

 

切换到gdal目录

 

cd ../gdal-2.2.0/swig/java/

 

 

make

 

cd .libs/

 

ls 

 

cp *.so /apps/app/gdal/libso/ 

 

posted @ 2017-08-03 00:06    阅读(...)  评论(...编辑  收藏