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

转载地址为: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

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试

关闭