Обсуждение: Problem building both Python 2 and 3 into Postgres 9.4.4?
Has anyone successfully built Python 2 and 3 into the same installation of Postgres 9.4.4? I tried it today on Ubuntu 10.04, Python 2.6.5, Python 3.1.2 and got and error about undefined symbol: PyString_AsString. The Python docs say that PyString_* have been renamed to PyBytes_* and I find references to both under ./src/pl/plpython. Is this a bug, something I'm doing wrong, or perhaps my system is too old? make distclean ./configure --with-openssl --with-libxml --with-libxslt --with-python PYTHON=/us r/bin/python make ./configure --with-openssl --with-libxml --with-libxslt --with-python PYTHON=/us r/bin/python3 make make install service postgresql restart psql -U postgres postgres=# create database py2; CREATE DATABASE postgres=# create database py3; CREATE DATABASE postgres=# \c py2 You are now connected to database "py2" as user "postgres". py2=# create extension plpython2u; CREATE EXTENSION py2=# \c py3 You are now connected to database "py3" as user "postgres". py3=# create extension plpython3u; ERROR: could not load library "/usr/local/pgsql/lib/plpython3.so": /usr/local/p gsql/lib/plpython3.so: undefined symbol: PyString_AsString
pbj@cmicdo.com writes: > Has anyone successfully built Python 2 and 3 into the same installation > of Postgres 9.4.4? I do not think you can do it like this: > make distclean > ./configure --with-openssl --with-libxml --with-libxslt --with-python PYTHON=/usr/bin/python > make > ./configure --with-openssl --with-libxml --with-libxslt --with-python PYTHON=/usr/bin/python3 > make > make install You need to configure and make one way, then install, then make distclean, reconfigure and remake the other way, then make install in only the src/pl/plpython directory. The recipe as you have it will end up with only one installed copy of plpython, not two, and I'm not real sure that that copy will be correctly built for either case. regards, tom lane
That worked, thank you. The Tip in 43.1 did not explain in that much detail. I searched but could not find that explained anywhere in the docs. Your paragraph would be a nice enhancement to the tip. PJ -------------------------------------------- On Sun, 7/19/15, Tom Lane <tgl@sss.pgh.pa.us> wrote: Subject: Re: [GENERAL] Problem building both Python 2 and 3 into Postgres 9.4.4? To: pbj@cmicdo.com Cc: pgsql-general@postgresql.org Date: Sunday, July 19, 2015, 4:54 PM pbj@cmicdo.com writes: > Has anyone successfully built Python 2 and 3 into the same installation > of Postgres 9.4.4? I do not think you can do it like this: > make distclean > ./configure --with-openssl --with-libxml --with-libxslt --with-python PYTHON=/usr/bin/python > make > ./configure --with-openssl --with-libxml --with-libxslt --with-python PYTHON=/usr/bin/python3 > make > make install You need to configure and make one way, then install, then make distclean, reconfigure and remake the other way, then make install in only the src/pl/plpython directory. The recipe as you have it will end up with only one installed copy of plpython, not two, and I'm not real sure that that copy will be correctly built for either case. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general