Re: starting out - Mailing list pgsql-general

From Phil Howard
Subject Re: starting out
Date
Msg-id 20030211104814.A17340@hamal.ipal.net
Whole thread Raw
In response to Re: starting out  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: starting out
List pgsql-general
On Tue, Feb 11, 2003 at 10:35:54AM -0500, Tom Lane wrote:

| Phil Howard <phil-pgsql-general@ipal.net> writes:
| > I compiled 7.3.2 and built a binary tarball to distribute to other
| > machines.  But the building, in particular the linking, has a problem
| > in the way it links to libssl.  Instead of making the linking reference
| > to the generic version level of the library, it makes it to the specific
| > patch level version.  The end result is that the compiled binary won't
| > run unless that EXACT version of libssl is present.
|
| Hmm.  When I build from source on a Linux box, I get generic references.
| For example, in a recent build on a RHL 8.0 box, I see:
| [tgl@rh1 bin]$ ldd psql
|         libpq.so.3 => /home/tgl/testversion/lib/libpq.so.3 (0x40013000)
|         libssl.so.2 => /lib/libssl.so.2 (0x4003e000)
|         libcrypto.so.2 => /lib/libcrypto.so.2 (0x4006e000)

I found out the problem.  It is in the OpenSSL default Makefile.

For the above 2 I was getting:

    libssl.so.0.9.7 => not found
    libcrypto.so.0.9.7 => not found

They were not found because the files available are:

    /lib/libcrypto.so -> libcrypto.so.0
    /lib/libcrypto.so.0 -> libcrypto.so.0.9.6
    /lib/libcrypto.so.0.9.6
    /lib/libssl.so -> libssl.so.0
    /lib/libssl.so.0 -> libssl.so.0.9.6
    /lib/libssl.so.0.9.6

The reason it picked 0.9.7 is because postgresql was compiled and linked
on a machine which had:

    /lib/libcrypto.so -> libcrypto.so.0
    /lib/libcrypto.so.0 -> libcrypto.so.0.9
    /lib/libcrypto.so.0.9 -> libcrypto.so.0.9.7
    /lib/libcrypto.so.0.9.7
    /lib/libssl.so -> libssl.so.0
    /lib/libssl.so.0 -> libssl.so.0.9
    /lib/libssl.so.0.9 -> libssl.so.0.9.7
    /lib/libssl.so.0.9.7

I had seen the behaviour before when dealing with OpenSSH, but wrote it
off as some "weird paranoia" of the OpenSSH developers.  But it was not
of their doing.  It was postgresql having the same thing that pointed me
to OpenSSL itself being the culprit.

What it did was:

    gcc -shared -o libcrypto.so.0.9.7 -Wl,-soname=libcrypto.so.0.9.7 ...

and when I changed it to do:

    gcc -shared -o libcrypto.so.0.9.7 -Wl,-soname=libcrypto.so.0 ...

instead and re-installed OpenSSL on the compile machine (safer to do it
there since it is physically local to me and I don't have to worry about
it bringing down my SSH daemon), then recompiled postgresql (recompiled
OpenSSH as well), I then got the references to:

root@hamal:/root 215> ldd /usr/opt/postgresql-7.3.2/bin/postgres
        libssl.so => /lib/libssl.so (0x4001b000)
        libcrypto.so => /lib/libcrypto.so (0x40049000)
        libz.so.1 => /lib/libz.so.1 (0x40106000)
        libreadline.so.4 => /usr/lib/libreadline.so.4 (0x40114000)
        libtermcap.so.2 => /lib/libtermcap.so.2 (0x40138000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4013c000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x4016b000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x4017c000)
        libdl.so.2 => /lib/libdl.so.2 (0x40191000)
        libm.so.6 => /lib/libm.so.6 (0x40195000)
        libc.so.6 => /lib/libc.so.6 (0x401b7000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
root@hamal:/root 216>

Well, this isn't exactly what I wanted, but it gets me rolling and
confirms I pinpointed the problem in OpenSSL.  I really want it to
reference the major version number.  But that is version 0, not 2
as Redhat seems to have.  I'll tweak the build scripts later and
redo it all again.

--
-----------------------------------------------------------------
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| phil-nospam@ipal.net | Texas, USA | http://ka9wgn.ham.org/    |
-----------------------------------------------------------------

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: PostgreSQL x Oracle
Next
From: Jean-Luc Lachance
Date:
Subject: Re: selects with large offset really slow