[Tutor] PyGreSQL compiliation difficulties

doug@nsacom.net doug@nsacom.net
Thu, 22 Mar 2001 22:59:47 -0800 (PST)


I got the PyGreSQL module from druid.net and have attempted to build it into 
my Python interpreter. It appears that PyGreSQL was written for Python 1.5 
and it's installation instructions seem to be somewhat different from the 
realities of my particular setup. 
 
The installation instructions in README.linux instruct me to:
__________________________________________________

BUILT-IN TO PYTHON INTERPRETER

* Find the directory where your 'Setup' file lives (usually ??/Modules) in 
  the Python source hierarchy and copy or symlink the 'pgmodule.c' file there.

* Add the following line to your Setup file
    _pg  pgmodule.c -I[pgInc] -L[pgLib] -lpq # -lcrypt # needed on some 
systems
  where:
    [pgInc] = path of PostgreSQL include (often /usr/local/include/python1.5)
    [pgLib] = path of the PostgreSQL libraries 
(often /usr/local/lib/python1.5)
  
___________________________________________________

My first confusion is: Why is it looking for the PostGreSQL inclue and 
libraries in /usr/local/lib/python.x? 

Undaunted by fear I included the line:

_pg  pgmodule.c -I /usr/local/include/python2.0 -L /usr/local/lib/python2.0 -
lpq  -lcrypt

which promptly craps with:

bad word /usr/local/lib/python2.0 in _pg pgmodule.c -
I /usr/local/include/python2.0 -L /usr/local/lib/python2.0 -lpq -lcrypt

which made me say bad words.

So I got to thinking (O!) Perhaps the instructions contained a typo and it 
actually wants the path to the PostGreSQL includes etc. ...So:

_pg  pgmodule.c -I /usr/local/pgsql/include/ -L /usr/local/pgsql/lib/cd  -
lpq  -lcrypt

which gave me the same error. 

Then I really got to wondering: Isn't all this mapping out of include files 
done for us by the deep, unfathomable majick of ./configure?

so I tried the vanilla approach:

_pg  pgmodule.c -lpq  -lcrypt

Which seemed to be percolating along nicely until:

./pgmodule.c:30: libpq-fe.h: No such file or directory

I do indeed have libpq installed as part of 
postgres: /usr/local/postgres/libpq-fe.h

Obviously it is crapping out because I don't have the path included that 
causes it to crap out. ;-)


So what am I missing? I am building this on Slackware 7.0. Python and 
Postgres have built and functioned just fine thereupon. Is there a way to 
include the pgmodule.c and it's attendant files in ./configure? (I am sure 
this is where part of the answer lies...) Python needs to know where the 
pgsql libraries are when it builds and it needs to know to build the pygres 
module... now I need to know how to tell configure! 

Thanks folks