Centos7编译JAVA版GDAL

所用软件如下:

proj-4.9.3.tar.gz

geos-3.6.2.tar.gz

jpegsrc.v9b.tar.gz

hdf-4.2.13.tar.gz

hdf5-1.10.1.tar.gz

netcdf-4.4.1.tar.gz

gdal-2.2.3.tar.gz

(经实践,在其他用户下存在某种问题,可能是对Centos系统上不熟悉,无法解决,需在root用户下安装)

现操作过程如下:

1.切换到root用户

su - root


2.安装依赖环境

yum  -y  groupinstall "Development tools"

yum -y install zlib-devel


3分别安装上述安装包如下:

tar -xjf geos-3.6.2.tar.bz2
cd proj-4.9.3
./configure
make
make install
cd ..

tar -xjf geos-3.6.2.tar.gz
cd geos-3.6.2
./configure
make
make install
ldconfig
cd ..

tar -zxf jpegsrc.v9b.tar.gz
cd jpeg-9b/
./configure --prefix=/opt/jpeg
make 
make install
cd ..

tar -zxf hdf5-1.10.1.tar.gz
cd hdf5-1.10.1
export F9X=ifort
./configure --prefix=/opt/hdf5 --with-hdf4=/opt/hdf4 --with-jpeg=/opt/jpeg --enable-java --enable-cxx
make 
make install
cd ..

tar -zxf hdf-4.2.13.tar.gz
cd hdf-4.2.13
./configure --prefix=/opt/hdf4 --enable-netcdf --enable-jpeg --with-jpeg=/opt/jpeg --enable-hdf5 --with-hdf5=/opt/hdf5 --enable-shared --disable-fortran --enable-java
make
make install
cd ..

tar -zxf netcdf-4.4.1.tar.gz
cd netcdf-4.4.1
CPPFLAGS="-l/opt/hdf4/include -l/opt/hdf5/include -l/opt/jpeg/include"
LDFLAGS="-l/opt/hdf4/lib -l/opt/hdf5/lib -l/opt/jpeg/lib"
./configure --prefix=/opt/netcdf --enable-hdf5 --with-hdf5=/opt/hdf5 --enable-hdf4 --with-hdf4=/opt/hdf4 --enable-jpeg --with-jpeg=/opt/jpeg --disable-netcdf-4
make
make install
cd ..

tar -zxf gdal-2.2.3.tar.gz
cd gdal-2.2.3
./configure --prefix=/opt/gdal --enable-netcdf --with-netcdf=/opt/netcdf --enable-hdf5 --with-hdf5=/opt/hdf5 --enable-hdf4 --with-hdf4=/opt/hdf4
make
make install
cd ..

4修改配置文件
vi  /etc/profile
export PATH=${PATH}:/opt/hdf4/include:/opt/hdf4/bin:/opt/hdf5/include:/opt/hdf5/bin:/opt/netcdf/include:/opt/netcdf/bin:/opt/gdal/include:/opt/gdal/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/hdf4/lib:/opt/hdf5/lib:/opt/netcdf/lib:/opt/gdal/lib

source  /etc/profile

5重启
reboot

6验证是否安装成功!
gdalinfo 


7编译JAVA版GDAL
进入<gdal-dir>\swig\java修改java.opt文件,指定jdk的路径,<gdal-dir>为gdal文件夹。内容如下: 
JAVA_HOME = /opt/jdk1.8
JAVADOC=$(JAVA_HOME)/bin/javadoc 
JAVAC=$(JAVA_HOME)/bin/javac 
JAVA=$(JAVA_HOME)/bin/java 
JAR=$(JAVA_HOME)/bin/jar 
JAVA_INCLUDE=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux 

进入<gdal-dir>\swig\java
make 
将编译好的动态库放到需要使用它的地方: 
libgdalconstjni.so
libgdaljni.so
libgnmjni.so
libogrjni.so
libosrjni.so
gdal.jar 
注意在编译的时候需要安装ant


展开阅读全文
©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值