Search code examples
postgresqlgispostgis

Error "the PGXS Makefile cannot be found" when installing PostGis on Debian


I am in the process of installing PostGis over psql on a Debian machine (actually crunchbang).

I have completed the following steps:

$ wget http://download.osgeo.org/postgis/source/postgis-2.0.3.tar.gz
$ tar xzf postgis-2.0.3.tar.gz
$ cd postgis-2.0.3
$ ./configure

On the final step I get the following error:

configure: error: the PGXS Makefile /usr/lib/postgresql/9.1/lib/pgxs/src/makefiles/pgxs.mk cannot be found. Please install the PostgreSQL server development packages and re-run configure.

The issue is that I do already have Postgres installed:

$ psql --version
psql (9.1.9)

I have checked this on two machines with the same configuration and get the same error. What am I missing here?


Solution

  • PostgreSQL is broken down into several packages, and having psql installed doesn't imply that the development packages are also installed.

    According to the error message:

    Please install the PostgreSQL server development packages and re-run configure

    you need:

    # apt-get install postgresql-server-dev-9.1
    

    Also note there's a APT pgdg repository providing recent pre-compiled versions of postgres-related packages (including postgis) that you may use instead of self-compiling.

    If your system is set up to use this repository, just do:

    # apt-get install postgresql-9.1-postgis-2.0