Обсуждение: Help needed building syscopg2
I am trying to install psycopg2 from source in Centos 6.7 x86_64, with Python 3.4.3 and Postgresql 9.4
I have overcomed and resolved the documented ‘gotchas’:
a) Access to pg_config >> Added “export POSTGRESQL_HOME=/usr/pgsql-9.4; pathmunge $POSTGRESQL_HOME/bin” to /etc/profile.d
b) Missing libpq-fs.h, pg_config_ext.h, postgres_ext.h, libpq-fe.h >> All moved to psycopg2-2.6.1 directory
Currently the build is failing the “python setup.py build” at gcc. The compiler complains about a “-lpq” switch (Just after “-o” switch. I am not being able to resolve this problem.
Compile messages follows:
=========================================
creating /root/psycopg2-2.6.1/build/lib.3.4
creating /root/psycopg2-2.6.1/build/lib.3.4/psycopg2
gcc -pthread -shared -Wl,-rpath /usr/local/lib build/temp.linux-x86_64-3.4/psycopg/psycopgmodule.o build/temp.linux-x86_64-3.4/psycopg/green.o build/temp.linux-x86_64-3.4/psycopg/pqpath.o build/temp.linux-x86_64-3.4/psycopg/utils.o build/temp.linux-x86_64-3.4/psycopg/bytes_format.o build/temp.linux-x86_64-3.4/psycopg/connection_int.o build/temp.linux-x86_64-3.4/psycopg/connection_type.o build/temp.linux-x86_64-3.4/psycopg/cursor_int.o build/temp.linux-x86_64-3.4/psycopg/cursor_type.o build/temp.linux-x86_64-3.4/psycopg/diagnostics_type.o build/temp.linux-x86_64-3.4/psycopg/error_type.o build/temp.linux-x86_64-3.4/psycopg/lobject_int.o build/temp.linux-x86_64-3.4/psycopg/lobject_type.o build/temp.linux-x86_64-3.4/psycopg/notify_type.o build/temp.linux-x86_64-3.4/psycopg/xid_type.o build/temp.linux-x86_64-3.4/psycopg/adapter_asis.o build/temp.linux-x86_64-3.4/psycopg/adapter_binary.o build/temp.linux-x86_64-3.4/psycopg/adapter_datetime.o build/temp.linux-x86_64-3.4/psycopg/adapter_list.o build/temp.linux-x86_64-3.4/psycopg/adapter_pboolean.o build/temp.linux-x86_64-3.4/psycopg/adapter_pdecimal.o build/temp.linux-x86_64-3.4/psycopg/adapter_pint.o build/temp.linux-x86_64-3.4/psycopg/adapter_pfloat.o build/temp.linux-x86_64-3.4/psycopg/adapter_qstring.o build/temp.linux-x86_64-3.4/psycopg/microprotocols.o build/temp.linux-x86_64-3.4/psycopg/microprotocols_proto.o build/temp.linux-x86_64-3.4/psycopg/typecast.o -L/usr/local/lib -L/usr/pgsql-9.4/lib -lpython3.4m -lpq -o /root/psycopg2-2.6.1/build/lib.3.4/psycopg2/_psycopg.cpython-34m.so
/usr/bin/ld: cannot find -lpq
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
make: *** [/root/psycopg2-2.6.1/build/lib.3.4/psycopg2/_psycopg.so] Error 1
=============================================================
I will Appreciate any suggestions.
Carlos Sotto Maior
It seems it didn't find libpq.so. Do you have the file in /usr/pgsql-9.4/lib? -- Daniele
Hi Danielle, Yes, I have libpq.so.5.7 in directory /usr/pgsql-9.4/lib. In the same directory there is also a soft link named libpq.so.5 which is mapped to libpq.so.5.7 Any other ideas ? Thanks, Carlos Sotto Maior csotto@uol.com.br -----Mensagem original----- De: Daniele Varrazzo [mailto:daniele.varrazzo@gmail.com] Enviada em: domingo, 27 de setembro de 2015 10:13 Para: Carlos Sotto Maior (UOL) Cc: psycopg@postgresql.org Assunto: Re: [psycopg] Help needed building syscopg2 It seems it didn't find libpq.so. Do you have the file in /usr/pgsql-9.4/lib? -- Daniele
On 09/28/2015 04:32 AM, Carlos Sotto Maior (UOL) wrote: > Hi Danielle, > > Yes, I have libpq.so.5.7 in directory /usr/pgsql-9.4/lib. > In the same directory there is also a soft link named libpq.so.5 which is mapped to libpq.so.5.7 > > Any other ideas ? How did you install Postgres 9.4? If it was by package, did you install the -dev package also? > > Thanks, > > Carlos Sotto Maior > csotto@uol.com.br > > > -----Mensagem original----- > De: Daniele Varrazzo [mailto:daniele.varrazzo@gmail.com] > Enviada em: domingo, 27 de setembro de 2015 10:13 > Para: Carlos Sotto Maior (UOL) > Cc: psycopg@postgresql.org > Assunto: Re: [psycopg] Help needed building syscopg2 > > It seems it didn't find libpq.so. Do you have the file in /usr/pgsql-9.4/lib? > > -- Daniele > > > -- Adrian Klaver adrian.klaver@aklaver.com
Hi Adrian, That might be the problem. But how do I get the -dev ? I noticed that -dev is not available from the .rpm I have downloaded from yum.postgresql.org.(See Below) Thanks for you comment. ========================================= [root@SRV-01 ~]# rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-4.noarch.rpm [root@SRV-01 ~]# yum --enablerepo pgdg94 install postgresql94 postgresql94-server postgresql94-libs postgresql94-contribpostgresql94-dev Loaded plugins: fastestmirror, security Setting up Install Process Loading mirror speeds from cached hostfile * base: centos.xpg.com.br * extras: centos.xpg.com.br * updates: centos.xpg.com.br Package postgresql94-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version Package postgresql94-server-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version Package postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version Package postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version No package postgresql94-dev available. ========================================= Carlos Sotto Maior csotto@uol.com.br -----Mensagem original----- De: Adrian Klaver [mailto:adrian.klaver@aklaver.com] Enviada em: segunda-feira, 28 de setembro de 2015 10:29 Para: Carlos Sotto Maior (UOL); 'Daniele Varrazzo' Cc: psycopg@postgresql.org Assunto: Re: RES: [psycopg] Help needed building syscopg2 On 09/28/2015 04:32 AM, Carlos Sotto Maior (UOL) wrote: > Hi Danielle, > > Yes, I have libpq.so.5.7 in directory /usr/pgsql-9.4/lib. > In the same directory there is also a soft link named libpq.so.5 which is mapped to libpq.so.5.7 > > Any other ideas ? How did you install Postgres 9.4? If it was by package, did you install the -dev package also? > > Thanks, > > Carlos Sotto Maior > csotto@uol.com.br > > > -----Mensagem original----- > De: Daniele Varrazzo [mailto:daniele.varrazzo@gmail.com] > Enviada em: domingo, 27 de setembro de 2015 10:13 > Para: Carlos Sotto Maior (UOL) > Cc: psycopg@postgresql.org > Assunto: Re: [psycopg] Help needed building syscopg2 > > It seems it didn't find libpq.so. Do you have the file in /usr/pgsql-9.4/lib? > > -- Daniele > > > -- Adrian Klaver adrian.klaver@aklaver.com
On Mon, Sep 28, 2015 at 4:39 PM, Carlos Sotto Maior (UOL) <csotto@uol.com.br> wrote:
Hi Adrian,
That might be the problem.
But how do I get the -dev ? I noticed that -dev is not available from the .rpm I have downloaded from yum.postgresql.org. (See Below)
Thanks for you comment.
=========================================
[root@SRV-01 ~]# rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-4.noarch.rpm
[root@SRV-01 ~]# yum --enablerepo pgdg94 install postgresql94 postgresql94-server postgresql94-libs postgresql94-contrib postgresql94-dev
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.xpg.com.br
* extras: centos.xpg.com.br
* updates: centos.xpg.com.br
Package postgresql94-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version
Package postgresql94-server-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version
Package postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version
Package postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version
No package postgresql94-dev available.
Maybe because it is called "postgresql94-devel" ?
On 09/28/2015 07:39 AM, Carlos Sotto Maior (UOL) wrote: > Hi Adrian, > That might be the problem. > But how do I get the -dev ? I noticed that -dev is not available from the .rpm I have downloaded from yum.postgresql.org.(See Below) I spend too much time in Debian/Ubuntu land, that should be -devel. See here for complete listing: http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/ > > Thanks for you comment. > > ========================================= > [root@SRV-01 ~]# rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-4.noarch.rpm > > [root@SRV-01 ~]# yum --enablerepo pgdg94 install postgresql94 postgresql94-server postgresql94-libs postgresql94-contribpostgresql94-dev > Loaded plugins: fastestmirror, security > Setting up Install Process > Loading mirror speeds from cached hostfile > * base: centos.xpg.com.br > * extras: centos.xpg.com.br > * updates: centos.xpg.com.br > Package postgresql94-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version > Package postgresql94-server-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version > Package postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version > Package postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version > No package postgresql94-dev available. > ========================================= > > Carlos Sotto Maior > csotto@uol.com.br > > -----Mensagem original----- > De: Adrian Klaver [mailto:adrian.klaver@aklaver.com] > Enviada em: segunda-feira, 28 de setembro de 2015 10:29 > Para: Carlos Sotto Maior (UOL); 'Daniele Varrazzo' > Cc: psycopg@postgresql.org > Assunto: Re: RES: [psycopg] Help needed building syscopg2 > > On 09/28/2015 04:32 AM, Carlos Sotto Maior (UOL) wrote: >> Hi Danielle, >> >> Yes, I have libpq.so.5.7 in directory /usr/pgsql-9.4/lib. >> In the same directory there is also a soft link named libpq.so.5 which is mapped to libpq.so.5.7 >> >> Any other ideas ? > > How did you install Postgres 9.4? > > If it was by package, did you install the -dev package also? > >> >> Thanks, >> >> Carlos Sotto Maior >> csotto@uol.com.br >> >> >> -----Mensagem original----- >> De: Daniele Varrazzo [mailto:daniele.varrazzo@gmail.com] >> Enviada em: domingo, 27 de setembro de 2015 10:13 >> Para: Carlos Sotto Maior (UOL) >> Cc: psycopg@postgresql.org >> Assunto: Re: [psycopg] Help needed building syscopg2 >> >> It seems it didn't find libpq.so. Do you have the file in /usr/pgsql-9.4/lib? >> >> -- Daniele >> >> >> > > -- Adrian Klaver adrian.klaver@aklaver.com
Hi Adrian, Thanks a lot for your help. Compile/build problem is solved . :) Carlos Sotto Maior csotto@uol.com.br -----Mensagem original----- De: Adrian Klaver [mailto:adrian.klaver@aklaver.com] Enviada em: segunda-feira, 28 de setembro de 2015 11:51 Para: Carlos Sotto Maior (UOL); 'Daniele Varrazzo' Cc: psycopg@postgresql.org Assunto: Re: RES: RES: [psycopg] Help needed building syscopg2 On 09/28/2015 07:39 AM, Carlos Sotto Maior (UOL) wrote: > Hi Adrian, > That might be the problem. > But how do I get the -dev ? I noticed that -dev is not available from > the .rpm I have downloaded from yum.postgresql.org. (See Below) I spend too much time in Debian/Ubuntu land, that should be -devel. See here for complete listing: http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/ > > Thanks for you comment. > > ========================================= > [root@SRV-01 ~]# rpm -ivh http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-4.noarch.rpm > > [root@SRV-01 ~]# yum --enablerepo pgdg94 install postgresql94 postgresql94-server postgresql94-libs postgresql94-contribpostgresql94-dev > Loaded plugins: fastestmirror, security Setting up Install Process > Loading mirror speeds from cached hostfile > * base: centos.xpg.com.br > * extras: centos.xpg.com.br > * updates: centos.xpg.com.br > Package postgresql94-9.4.4-1PGDG.rhel6.x86_64 already installed and > latest version Package postgresql94-server-9.4.4-1PGDG.rhel6.x86_64 > already installed and latest version Package > postgresql94-libs-9.4.4-1PGDG.rhel6.x86_64 already installed and > latest version Package postgresql94-contrib-9.4.4-1PGDG.rhel6.x86_64 already installed and latest version No package postgresql94-devavailable. > ========================================= > > Carlos Sotto Maior > csotto@uol.com.br > > -----Mensagem original----- > De: Adrian Klaver [mailto:adrian.klaver@aklaver.com] > Enviada em: segunda-feira, 28 de setembro de 2015 10:29 > Para: Carlos Sotto Maior (UOL); 'Daniele Varrazzo' > Cc: psycopg@postgresql.org > Assunto: Re: RES: [psycopg] Help needed building syscopg2 > > On 09/28/2015 04:32 AM, Carlos Sotto Maior (UOL) wrote: >> Hi Danielle, >> >> Yes, I have libpq.so.5.7 in directory /usr/pgsql-9.4/lib. >> In the same directory there is also a soft link named libpq.so.5 >> which is mapped to libpq.so.5.7 >> >> Any other ideas ? > > How did you install Postgres 9.4? > > If it was by package, did you install the -dev package also? > >> >> Thanks, >> >> Carlos Sotto Maior >> csotto@uol.com.br >> >> >> -----Mensagem original----- >> De: Daniele Varrazzo [mailto:daniele.varrazzo@gmail.com] >> Enviada em: domingo, 27 de setembro de 2015 10:13 >> Para: Carlos Sotto Maior (UOL) >> Cc: psycopg@postgresql.org >> Assunto: Re: [psycopg] Help needed building syscopg2 >> >> It seems it didn't find libpq.so. Do you have the file in /usr/pgsql-9.4/lib? >> >> -- Daniele >> >> >> > > -- Adrian Klaver adrian.klaver@aklaver.com