GIG

赴くままに技術を。

Mac OSX 10.7.5でGEOS 3.3.8がインストールできない

GEOSをインストールしてみた

GEOSは、地理空間情報に関連するC++のライブラリで、PostGISをインストールするときに必要となる。 それをOSX 10.7.5環境でインストールしてみた。

ダウンロード

ソースファイルをダウンロードしてくる。 バージョンは3.3.8を使用する。

# cd /pass/to/your/install/dir/
# wget http://download.osgeo.org/geos/geos-3.3.8.tar.bz2

インストール

./configureでインストールディレクトリのみ指定して、make

# ./configure --prefix=/pass/to/your/install/dir/geos3.3.8
# make

 ...(省略)...

Undefined symbols for architecture x86_64:
"std::auto_ptr<geos::geom::Envelope>::auto_ptr(std::auto_ptr_ref<geos::geom::Envelope>)", 
referenced from:
virtual thunk to geos::geom::GeometryCollection::computeEnvelopeInternal() constin 
libgeom.a(GeometryCollection.o)
  "__ZNSt8auto_ptrIN4geos4geom8EnvelopeEEcvSt12auto_ptr_refIT_EIS2_EEv", referenced 
 from:
  virtual thunk to geos::geom::GeometryCollection::computeEnvelopeInternal() constin    
  libgeom.a(GeometryCollection.o)
  ld: symbol(s) not found for architecture x86_64
 collect2: ld returned 1 exit status
 make[2]: *** [libgeos.la] Error 1
 make[1]: *** [all-recursive] Error 1
 make: *** [all-recursive] Error 1

おろろ-? なんだかライブラリが足りてなくて怒られているのか...?

解決策

自分のメモをあさるとなんと過去にもぶつかっていた見たい。 しかし、情報のリンクのみ...。 ちゃんと残せやっ! 自分っ!

Mac OSX Lionで起きている問題みたい。 GEOSで管理しているTracで起票されていた。

結論から言うとconfigureを以下のように行う

./configure \
--prefix=/opt/postgres/geos3.3.8 \
CC=/usr/bin/clang \
CXX=/usr/bin/clang++

コンパイラとしてclangを指定するとmakeが通る。