zuntan02のはてなブログ

備忘録的なものです。時々職場の技術者ブログにも転記してますが、メインはこちらで。

PostGISのconfigureでchecking for library containing GDALAllRegister... no って言われたメモ

# What's PostGIS
# →PostGIS (ぽすとじす) は PostgreSQL データベースで地理空間情報を扱うための拡張である。
#  GNU General Public License のオープンソースソフトウェアとして配布されている。

【問題】

Chapter 2. PostGIS Installation

必須モジュールおよびバージョン
PostgreSQL 9.2 or higher
GNU C compiler (gcc)
GNU Make (gmake or make)
Proj4 reprojection library, version 4.6.0 or greater
GEOS geometry library, version 3.3 or greater
LibXML2, version 2.5.x or higher
JSON-C, version 0.9 or higher
GDAL, version 1.8 or higher

モジュール群を上記URLにある取得元からそれぞれwgetしてconfigureしてmakeしてmake installしたのち、

wget http://download.osgeo.org/postgis/source/postgis-2.3.2.tar.gz
tar -xvzf postgis-2.3.2.tar.gz
cd postgis-2.3.2
./configure

としたところ、以下のエラーとなってハマった。GDALもインストールしたのだけど。。

checking for library containing GDALAllRegister... no
configure: error: could not find GDAL

【解決】

postgisのconfig.logに

/usr/bin/ld: warning: libpq.so.5, needed by /usr/local/lib/libgdal.so, not found (try using -rpath or -rpath-link)

っていうのがあった。libpq.so.5は /usr/local/pgsql/lib の下にあったので

/etc/ld.so.conf の末尾に以下を追記

/usr/local/pgsql/lib

↓↓

 -------------- Compiler Info -------------
  C compiler:           gcc -g -O2
  SQL preprocessor:     /usr/bin/cpp -traditional-cpp -w -P

 -------------- Dependencies --------------
  GEOS config:          /usr/local/bin/geos-config
  GEOS version:         3.6.1
  GDAL config:          /usr/local/bin/gdal-config
  GDAL version:         2.2.0
  PostgreSQL config:    /usr/local/pgsql/bin/pg_config
  PostgreSQL version:   PostgreSQL 9.3.4
  PROJ4 version:        49
  Libxml2 config:       /usr/bin/xml2-config
  Libxml2 version:      2.7.6
  JSON-C support:       no
  PCRE support:         no
  PostGIS debug level:  0
  Perl:                 /usr/bin/perl

 --------------- Extensions ---------------
  PostGIS Raster:       enabled
  PostGIS Topology:     enabled
  SFCGAL support:       disabled
  Address Standardizer support:       disabled

 -------- Documentation Generation --------
  xsltproc:
  xsl style sheets:
  dblatex:
  convert:
  mathml2.dtd:          http://www.w3.org/Math/DTD/mathml2/mathml2.dtd

通った。。。