[Pythonmac-SIG] PostgreSQL and PL/Python

Peter Herndon herndonp at mskcc.org
Tue Oct 21 10:28:50 EDT 2003


Hello all,

Has anyone had any success getting plpython to compile successfully for 
PostgreSQL?  I am running OS 10.2.8, MacPython 2.3.2, and am working 
with PostgreSQL 7.4beta4.  I've also tried with 7.3.4, and ran into 
even uglier errors -- it claims there's a syntax error in 
/usr/include/math.h -- so I stopped and tried with the latest beta.

My results are somewhat frustrating, as I seem to be running into a 
problem with linking in the shared version of the Python library.  I 
have set LDFLAGS to '-u __dummy -u_PyMac_Error -framework System 
-framework Python -framework CoreServices -framework Foundation', as 
per the Python documentation's advice (>>>import distutils.sysconfig, 
 >>>distutils.sysconfig.get_config_var('LINKFORSHARED').  I have set my 
PATH to include /usr/local/bin, so as to find my updated python first.  
My ./configure options are straight-forward, './configure --with-perl 
--with-python --with-rendezvous --with-openssl --without-readline', and 
seem to work just fine.  I'm suspicious of the last line, though.  The 
relevant output is:

checking for python... /usr/local/bin/python
checking Python installation directories... 
/Library/Frameworks/Python.framework/Version/2.3/lib/python2.3
checking how to link an embedded Python application... 
-L/Library/Frameworks/Python.framework/Version/2.3/lib/python2.3/config 
-lpython2.3

However, when I run make, I get the following:

plpython.c:41:19: dlfcn.h: No such file or directory
[snip warnings regarding use of long double]
make[3]: *** [plpython.o] Error 1

I took a look at plpython.c, and it is simply including dlfcn.h, so I 
looked at dlfcn.h and found two separate versions.  One version is in 
postgresql-7.4beta4/src/include/port/win32/dlfcn.h, and is blank.  The 
other is in my python 2.3.2 source tree, 
Python-2.3.2/PC/os2emx/dlfcn.h, and according to the comments in the 
file it "implements dlopen() -- Unix-like dynamic linking emulation 
functions for OS/2 using DosLoadModule() and company".  It didn't seem 
relevant at all, so I commented out the include line in plpython.c, and 
tried again.

My make results this time were somewhat more to the point, though no 
less frustrating.  The output:

[snip]
gcc -no-cpp-precomp -g -O2 -Wall -Wmissing-prototypes 
-Wmissing-declarations -bundle plpython.o -L../../../src/port 
-bundle_loader ../../../src/backend/postgres 
-L/Library/Frameworks/Python.framework/Version/2.3/lib/python2.3/config 
-lpython2.3  -o libplpython.so.0.0
ld: can't locate file for: -lpython2.3
make[3]: *** [libplpython.so.0.0] Error 1
[snip]

Now, this is looking a lot like PostgreSQL's configure script, 
particularly the third output line quoted above, is somewhat ignorant 
of how to handle a framework build of Python as a shared library under 
OS X.  Am I correct?  How do I go about correcting this problem, does 
anyone have any hints on this one?

FWIW, the PostgreSQL archives are remarkably reticent on the subject of 
compiling under OS X, and there are zero mentions of how to deal with 
building pl/python.

Thanks in advance.

---Peter Herndon


 
     =====================================================================
     
     Please note that this e-mail and any files transmitted with it may be 
     privileged, confidential, and protected from disclosure under 
     applicable law. If the reader of this message is not the intended 
     recipient, or an employee or agent responsible for delivering this 
     message to the intended recipient, you are hereby notified that any 
     reading, dissemination, distribution, copying, or other use of this 
     communication or any of its attachments is strictly prohibited.  If 
     you have received this communication in error, please notify the 
     sender immediately by replying to this message and deleting this 
     message, any attachments, and all copies and backups from your 
     computer.




More information about the Pythonmac-SIG mailing list