linux环境下成功编译GDAL为JAVA库

本文详细介绍了在Ubuntu环境下构建GDAL Java Bindings的步骤,包括所需依赖库PROJ4的安装与配置,GDAL的下载、配置及编译过程,以及如何设置JAVA_HOME环境变量和最终编译生成的.so文件的处理。
摘要由CSDN通过智能技术生成

转载地址为:http://blog.csdn.net/zlxzlxzlxzlxzlx/article/details/8629088

具体方法如下(亲测,编译成功):

Gulo, the VertNet harvester, uses Cascalog for running MapReduce queries, and we need Java GDAL bindings, so they need to be built. Here are the steps for Ubuntu.

 

Building

Before building, we'll need PROJ4 for reprojection support, so let's get that installed first:

在构建之前,我们需要 PROJ4 以提供投影支持,因此让我们先安装它:

$ curl -O http://download.osgeo.org/proj/proj-4.8.0.tar.gz
$ tar xvfz proj-4.8.0.tar.gz
$ cd proj-4.8.0
$ ./configure
$ make
$ sudo make install

That installs the native libraries in /usr/local/lib/libproj*. Now we're ready for GDAL! Buuut, if you see any unexpected errors, try asudo apt-get install proj4.

以上将本地库安装在 /usr/local/lib/libproj*,现在我们已为 GDAL 准备就绪!但是,如果你看见了任何意想不到的错误,那么试一下 sudo apt-get install proj4。

 

First download, configure, and make GDAL:

第一步,下载、配置 并编译 GDAL:

$ curl -O http://download.osgeo.org/gdal/gdal-1.9.1.tar.gz
$ tar xvfz gdal-1.9.1.tar.gz
$ cd gdal-1.9.1
$ ./configure --with-static-proj4=/usr/local --with-java=yes
$ make

 

Next edit gdal-1.9.1/swig/Java/java.opt with your JAVA_HOME path:

下一步,编辑 gdal-1.9.1/swig/java/java.opt 配置 JAVA_HOME 路径:

JAVA_HOME = "/usr/lib/jvm/java-6-openjdk-amd64"
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

 

Almost there! Just make it:

到此,即可编译它:

$ cd gdal-1.9.1/swig/java/
$ make

 

And finally copy the resulting .so files into a directory and update yourLD_LIBRARY_PATH environment variable to point to them:

最后,拷贝编译好的 .so 文件到一个目录,并更新你的 LD_LIBRARY_PATH 环境变量以便指向这些 .so 文件:

$ cd /gdal-1.9.1/swig/java
$ ls | grep .so
libgdalconstjni.so
libgdaljni.so
libogrjni.so
libosrjni.so
$ cp *.so ~/opt/linuxnative/
$ export LD_LIBRARY_PATH=~/opt/linuxnative/ # Put this in .bashrc

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值