Re: error after installing on CentOS 5.8 with source

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: error after installing on CentOS 5.8 with source
Дата
Msg-id CA+mi_8Ytow_hEyA8nR3JtWdakrpoR8dWuRY6PXEdeYMO-AZq+A@mail.gmail.com
обсуждение исходный текст
Ответ на error after installing on CentOS 5.8 with source  (Alan Etkin <spametki@gmail.com>)
Список psycopg
On Thu, Jul 26, 2012 at 11:21 PM, Alan Etkin <spametki@gmail.com> wrote:
> Hi
>
> I am trying to build and install psycopg2-2.4.5 source distribution on
> CentOS 5.8 VPS.
> Installation ends without errors, but on Python interpreter, import psycopg2
> returns:
>
> [...]
> ImportError:
> /opt/python2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so: undefined
> symbol: lo_truncate
>
> I know It can be related to the issue posted in the FAQ
> http://initd.org/psycopg/docs/faq.html#problems-compiling-and-deploying-psycopg2
>
> "...You can avoid the problem by using the same version of the pg_config at
> install time and the libpq at runtime. ..."

Yep, that's the case.

> But I cannot find the command/configuration needed to control the pg_config
> used at runtime, so I can set the pg_config to the newest version both for
> installation and runtime.

You cannot choose explicitly the lib to use at runtime: you should
manipulate the LD_LIBRARY_PATH to include the newest dir... which is a
pain in the neck. You better compile using the older pg_config.

> Note: I have configured setup.cfg so it reads the updated pg_config file (pg
> 9.1) before installation.

Yes, this is the problem. You compile with library and headers
offering lo_truncate but don't make it available at runtime.


> This is what ldd returns
>
> [root@pycom ~] #  ldd
> /opt/python2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so | grep libpq
>         libpq.so.4 => /usr/lib/libpq.so.4 (0x00716000)
>

Yes, this is the 8.1 version.

> There is an older pg_config version stored in /usr/bin with this output:
> LIBDIR = /usr/lib
> VERSION = PostgreSQL 8.1.23

> The new pg_config output:
> LIBDIR = /usr/pgsql-9.1/lib
> VERSION = PostgreSQL 9.1.4

You would live a much healthier life if you could get rid of Postgres
8.1, which is unsupported by the way, and install 9.1 in a standard
location, such as /usr/local/

If you cannot do this, either you compile psycopg against PG 8.1 by
using the pg_config in /usr/bin, or you compile for PG 9.1 but set the
LD_LIBRARY_PATH everywhere you need psycopg2 (you may also try hacking
psycopg's __init__.py file setting os.environ['LD_LIBRARY_PATH'] =
'/usr/pgsql-9.1/lib' before the first "from _psycopg import...")

Note that installing 9.1 in /usr/local could be enough to have the
newer libpq found automatically instead of the older, but I'm not
sure. You can try creating a symlink to the newer libpq.so into
/usr/local/lib and use ldd to check it gets used. This would have a
global effect though: can't guarantee there will be no side effects
from the libraries mixup.

-- Daniele

В списке psycopg по дате отправления:

Предыдущее
От: Alan Etkin
Дата:
Сообщение: error after installing on CentOS 5.8 with source
Следующее
От: Alan Etkin
Дата:
Сообщение: error after installing on CentOS 5.8 with source