[postgis-users] Error running lwpostgis.sql - Missing PG_MODULE_MAGIC

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Fri Jun 27 06:47:43 PDT 2008

Christian Gadge wrote:
> Hello List,
> I've some problems during install postgis1.3.3 on Ubuntu-6.06-Server with PostgreSQL-8.2.7.
> When I try to run the lwpostgis.sql I get the following massage:
> psql:/usr/local/pgsql/share/lwpostgis.sql:45: NOTICE:  type "histogram2d"
> is not yet defined
> DETAIL:  Creating a shell type definition.
> psql:/usr/local/pgsql/share/lwpostgis.sql:45: ERROR:  incompatible library
> "/usr/local/pgsql/lib/liblwgeom.so": missing magic block
> HINT:  Extension libraries are required to use the PG_MODULE_MAGIC macro.
> Searching the mailing list I found many topics with the same problem. Some guys advised to insert the following lines in one (?!) modul:
> /*#include "pgmagic.h"*/
> #endif
> So I checked the lwgeom_pg.c in the contrib dir of PostgreSQL /postgresql-8.2.7/cpntrib/postgres-1.3.3/lwgeom
> and these lines are allready written there.
> What should I do / check next? Did I made any mistakes by installing PostgreSQL and PostGIS via selfcompiling and installing?
> Before I installed these versions, PostgreSQL-8.1 was installed via apt-get and removed.
> Thanks for any help.
> Cheers,
> Christian

Hi Christian,

PG_MODULE_MAGIC was only included from PostgreSQL 8.2 upwards, so it 
sounds as if the PostGIS configure script picked up the older PostgreSQL 
version instead. You should do a "make clean" in your PostGIS source 
directory, and then re-run configure with an additional 
"--with-pgsql=/usr/local/pgsql/bin/pg_config" argument to force it to 
pick up the newer installation. Follow this with "make install" and you 
should then be good to go.



Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
T: +44 870 608 0063

More information about the postgis-users mailing list