Thread: question about 2 versions and libraries

question about 2 versions and libraries

From
Tina Messmann
Date:
Hello List,
i have version 7.1.3 (debian package) and version 7.2.1 (compiled from
source) an the same box.
both versions (server and client programs) use the libs from the debian
installation.
i found a few postings with this topic and there is said to set
LD_LIBRARY_PATH to the correct lib path.
i did this but still the libs from the debian installation are used
(despite of libpg.so.2):

arwen:~# set |grep LD
LD_LIBRARY_PATH=/usr/local/postgresql7.2.1/lib
arwen:~# ldd /usr/local/postgresql7.2.1/bin/psql
       libpq.so.2 => /usr/local/postgresql7.2.1/lib/libpq.so.2 (0x40016000)
       libcrypt.so.1 => /lib/libcrypt.so.1 (0x400d8000)
       libresolv.so.2 => /lib/libresolv.so.2 (0x40105000)
       libnsl.so.1 => /lib/libnsl.so.1 (0x40117000)
       libdl.so.2 => /lib/libdl.so.2 (0x4012c000)
       libm.so.6 => /lib/libm.so.6 (0x40130000)
       libreadline.so.4 => /lib/libreadline.so.4 (0x40152000)
       libc.so.6 => /lib/libc.so.6 (0x40178000)
       libncurses.so.5 => /lib/libncurses.so.5 (0x4029b000)
       /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
arwen:~#

and another problem is arising with LD_LIBRARY_PATH set
(unix_socket_directory is set to /var/run/postgresql in postgresql.conf):

arwen:~# /usr/local/postgresql7.2.1/bin/psql -p 6543 template1
psql: could not connect to server: No such file or directory
       Is the server running locally and accepting
       connections on Unix domain socket "/tmp/.s.PGSQL.6543"?
arwen:~#

Any hints??

Regards
Tina

ps: i am not getting mails from the list since yesterday , are there any
problems?




Re: question about 2 versions and libraries

From
Oliver Elphick
Date:
On Mon, 2002-05-27 at 09:25, Tina Messmann wrote:
> Hello List,
> i have version 7.1.3 (debian package) and version 7.2.1 (compiled from
> source) an the same box.

There is a Debian package of 7.2.1

> both versions (server and client programs) use the libs from the debian
> installation.
> i found a few postings with this topic and there is said to set
> LD_LIBRARY_PATH to the correct lib path.
> i did this but still the libs from the debian installation are used
> (despite of libpg.so.2):
>
> arwen:~# set |grep LD
> LD_LIBRARY_PATH=/usr/local/postgresql7.2.1/lib
> arwen:~# ldd /usr/local/postgresql7.2.1/bin/psql
>        libpq.so.2 => /usr/local/postgresql7.2.1/lib/libpq.so.2 (0x40016000)

This is from /usr/local (that is, your local build and not the Debian
package).  What is the problem?

>        libcrypt.so.1 => /lib/libcrypt.so.1 (0x400d8000)
>        libresolv.so.2 => /lib/libresolv.so.2 (0x40105000)
>        libnsl.so.1 => /lib/libnsl.so.1 (0x40117000)
>        libdl.so.2 => /lib/libdl.so.2 (0x4012c000)
>        libm.so.6 => /lib/libm.so.6 (0x40130000)
>        libreadline.so.4 => /lib/libreadline.so.4 (0x40152000)
>        libc.so.6 => /lib/libc.so.6 (0x40178000)
>        libncurses.so.5 => /lib/libncurses.so.5 (0x4029b000)
>        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> arwen:~#
>
> and another problem is arising with LD_LIBRARY_PATH set
> (unix_socket_directory is set to /var/run/postgresql in postgresql.conf):
> arwen:~# /usr/local/postgresql7.2.1/bin/psql -p 6543 template1
> psql: could not connect to server: No such file or directory
>        Is the server running locally and accepting
>        connections on Unix domain socket "/tmp/.s.PGSQL.6543"?

Have you started the postmaster on that port?

Are you looking at the right postgresql.conf?  The Debian file
/etc/postgresql/postgresql.conf is the target of a symbolic link from
$PGDATA/postgresql.conf.  The file you need to change is in the PGDATA
for your 7.2.1 postmaster.  If you want it to be the same as for the
Debian package, you must make a symbolic link there to
/etc/postgresql/postgresql.conf.  Otherwise it will use the default
created by initdb.

Have you got PGDATA set correctly in both your client and your
postmaster environments?

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "All that the Father giveth me shall come to me; and
      him that cometh to me I will in no wise cast out."
                                      John 6:37

Attachment

Re: question about 2 versions and libraries

From
Tina Messmann
Date:
Oliver Elphick wrote:

>On Mon, 2002-05-27 at 09:25, Tina Messmann wrote:
>
>>Hello List,
>>i have version 7.1.3 (debian package) and version 7.2.1 (compiled from
>>source) an the same box.
>>
>
>There is a Debian package of 7.2.1
>
i know this, but i want to keep the old version as long as i know that
everything is working with 7.2.1

[snip....]

>
>This is from /usr/local (that is, your local build and not the Debian
>package).  What is the problem?
>
uh...no problem, sorry about that...
[snip...]

>>
>>and another problem is arising with LD_LIBRARY_PATH set
>>(unix_socket_directory is set to /var/run/postgresql in postgresql.conf):
>>arwen:~# /usr/local/postgresql7.2.1/bin/psql -p 6543 template1
>>psql: could not connect to server: No such file or directory
>>       Is the server running locally and accepting
>>       connections on Unix domain socket "/tmp/.s.PGSQL.6543"?
>>
>
>Have you started the postmaster on that port?
>
yes. 7.1.3  (deb package) is listening on 5432, 7.2.1 (from tarball) is
listening on 6543

>
>Are you looking at the right postgresql.conf?  The Debian file
>/etc/postgresql/postgresql.conf is the target of a symbolic link from
>$PGDATA/postgresql.conf.  The file you need to change is in the PGDATA
>for your 7.2.1 postmaster.  If you want it to be the same as for the
>Debian package, you must make a symbolic link there to
>/etc/postgresql/postgresql.conf.  Otherwise it will use the default
>created by initdb.
>
arwen:~# cat /var/lib/postgres7.2.1/data/postgresql.conf |grep unix_socket_dir
unix_socket_directory = '/var/run/postgresql'
arwen:~#

i solved this problem now by setting PGHOST to /var/run/postgresql (is
this the common solution?)

>
>Have you got PGDATA set correctly in both your client and your
>postmaster environments?
>
no, i didn'd do that, where is the best place to set this variable for
the client environment? is it .profile or profile?
but what happens when then calling the debian version? hmmm...should be
no problem, since the commands from the debian package uses a wrapper
that sets the environment correctly, am i right with that?

Thank you for the help.
Tina


Re: question about 2 versions and libraries

From
Tom Lane
Date:
Tina Messmann <tina.messmann@xinux.de> writes:
> i solved this problem now by setting PGHOST to /var/run/postgresql (is
> this the common solution?)

If you want to run with a nonstandard socket file location, you have
to tell both postmaster and psql at runtime (psql cannot see the
postgresql.conf file, so you have to tell it separately).  Possibly
a better answer is to make the socket file location standard by altering
DEFAULT_PGSOCKET_DIR in src/include/pg_config.h before you build.

            regards, tom lane

Re: question about 2 versions and libraries

From
Oliver Elphick
Date:
On Mon, 2002-05-27 at 14:34, Tina Messmann wrote:
> Oliver Elphick wrote:
> >Are you looking at the right postgresql.conf?  The Debian file
> >/etc/postgresql/postgresql.conf is the target of a symbolic link from
> >$PGDATA/postgresql.conf.  The file you need to change is in the PGDATA
> >for your 7.2.1 postmaster.  If you want it to be the same as for the
> >Debian package, you must make a symbolic link there to
> >/etc/postgresql/postgresql.conf.  Otherwise it will use the default
> >created by initdb.
> >
> arwen:~# cat /var/lib/postgres7.2.1/data/postgresql.conf |grep unix_socket_dir
> unix_socket_directory = '/var/run/postgresql'
> arwen:~#
>
> i solved this problem now by setting PGHOST to /var/run/postgresql (is
> this the common solution?)
>
> >
> >Have you got PGDATA set correctly in both your client and your
> >postmaster environments?
> >
> no, i didn'd do that, where is the best place to set this variable for
> the client environment? is it .profile or profile?

That depends on your shell: .profile for sh, .bash_profile for bash, and
so on.

> but what happens when then calling the debian version? hmmm...should be
> no problem, since the commands from the debian package uses a wrapper
> that sets the environment correctly, am i right with that?

No, PGDATA in the environment should override the wrapper.

Best to create a testing script to set up the environment.  Call it
psql721 and make sure it is in your path:

    #!/bin/sh
    PGDATA=/usr/local/pgsql/data
    PGPORT=6543
    PGHOST=
    PGLIB=/usr/local/pgs1ql/lib
    PATH=/usr/local/pgsql/bin:$PATH
    LD_LIBRARY_PATH=$PGLIB:$LD_LIBRARY_PATH
    export PGDATA PGPORT PGHOST PGLIB PATH LD_LIBRARY_PATH
    psql $@

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "All that the Father giveth me shall come to me; and
      him that cometh to me I will in no wise cast out."
                                      John 6:37

Attachment

Re: question about 2 versions and libraries

From
Tina Messmann
Date:
Oliver Elphick wrote:

>On Mon, 2002-05-27 at 14:34, Tina Messmann wrote:
>
>>Oliver Elphick wrote:
>>
>
>No, PGDATA in the environment should override the wrapper.
>
Indeed it does.

>
>
>Best to create a testing script to set up the environment.  Call it
>psql721 and make sure it is in your path:
>
>    #!/bin/sh
>    PGDATA=/usr/local/pgsql/data
>    PGPORT=6543
>    PGHOST=
>    PGLIB=/usr/local/pgs1ql/lib
>    PATH=/usr/local/pgsql/bin:$PATH
>    LD_LIBRARY_PATH=$PGLIB:$LD_LIBRARY_PATH
>    export PGDATA PGPORT PGHOST PGLIB PATH LD_LIBRARY_PATH
>    psql $@
>
>
Great. I have now 2 scripts like the above one, one for 7.1.3. and one
for 7.2.1 to set the appropriate environments before starting psql.

Thanks for your help.
Tina