libgeotiff在gcc 4.x下的问题

1. 为何不在repository里?
一直以为libgeotiff应该在debian的库里,今天才发现libgeotiff不在debian/ubuntu的库里。
google后发现:
1 [DebianGIS-dev] licensing issue in libgeotiff
2 license issue in libgeotiff
从连接2里知道,DEBIAN默认就没有提供libgeotiff,而是通过gdal内置geotiff支持。
但是ossim这个软件也支持GDAL,但同时也要求libgeotiff。
2. 下载编译安装
在安装之前,要现安装libtiff及其开发包。

sudo aptitude install libtiff4 libtiff4-dev

因此,我就需要手工编译了,就从CVS上下载最新的代码来进行处理:

// 密码为空白
cvs -d :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot login
password:
// 获取geotiff
cvs -d :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot co geotiff
cd geotiff/libgeotiff
./configure
make

但在我的机器上(ubuntu edgy),这一步出现了问题:

make[1]: Entering directory `/home/wlx/ubuntu/ossim.org/geotiff/libgeotiff/bin’
gcc -O2 -Wall makegeo.o -L/lib -L.. -lgeotiff -lproj -ltiff -ljpeg -lz -lm -o makegeo
/usr/bin/ld: makegeo: hidden symbol `__stack_chk_fail_local’ in /usr/lib/libc_nonshared.a(stack_chk_fail_local.oS) is referenced by DSO
/usr/bin/ld: final link failed: 输出不可表示的节
collect2: ld returned 1 exit status
make[1]: *** [makegeo] 错误 1
make[1]: Leaving directory `/home/wlx/ubuntu/ossim.org/geotiff/libgeotiff/bin’
make: *** [Progs] 错误 2

这个问题比较怪,继续google,果然发现了答案

The issue is that libgeotiff’s configure script looks around for how to build
shared libraries, and concludes that it needs to do “ld -shared” to make
libgeotiff.so from its object files. This is, however, completely incorrect
with GCC 4.x. The right thing to do is “gcc -shared”

原来是gcc 4后产生的变化,呵呵,水土不服阿。
那就需要这样操作了:

./configure –with-ld-shared=”gcc -shared” –prefix=/usr
make
checkinstall -D
sudo dpkg -i *.deb

终于解决了这个问题,庆祝一下!

This entry was posted in Linux and tagged , , , . Bookmark the permalink.

One Response to libgeotiff在gcc 4.x下的问题

  1. Pingback: LiangXu Wang » Howto: compile and install ossim in ubuntu edgy

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string anXfma to the field below:

以新浪微博帐号登录