Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 352147 - Slotted install of two postgres servers and LDPATH issue
Summary: Slotted install of two postgres servers and LDPATH issue
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
: 359361 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-19 19:17 UTC by David Flogeras
Modified: 2011-04-03 16:32 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Flogeras 2011-01-19 19:17:52 UTC
I have both a postgres 8.4 and 9.0 installation on a machine because I am doing some performance comparisons between the two.

If I use "eselect postgresql ..." to switch both the Utilities and Service over to 9.0, I can see that the include/ and lib/ symlinks are made correctly.

If I compile a test program and link against -lpq, then run ldd ./a.out, that shows me it will _run_ against libpq.so.5 within the postgresql-8.4/lib directory.

The only thing I notice is that in /etc/env.d, both are present, and since the lib is libpq.so.5.3 in both cases, it seems to just pick the first one.

I know Aaron mentions a new eselect module for postgresql in bug #343883, so this may already be fixed in that.
Comment 1 Aaron W. Swenson gentoo-dev 2011-01-20 01:02:56 UTC
Yes, I have taken this into consideration and the updated module will handle this properly.

This bug will remain open as it will be a month or two before the module can hit the tree. (Init script and ebuild changes need to take place, so those updates have to hit the tree first.)
Comment 2 David Flogeras 2011-01-20 01:32:01 UTC
Excellent, thanks for the update.  For the interim I will just do "LD_LIBRARY_PATH=/path/to/the/one/i/want ./my_prog", does that sound reasonable?
Comment 3 Aaron W. Swenson gentoo-dev 2011-01-20 11:10:16 UTC
(In reply to comment #2)
> Excellent, thanks for the update.  For the interim I will just do
> "LD_LIBRARY_PATH=/path/to/the/one/i/want ./my_prog", does that sound
> reasonable?
> 

Yup, that should do it.
Comment 4 Aaron W. Swenson gentoo-dev 2011-03-19 22:13:12 UTC
Please review app-admin/eselect-postgresql-1.0.3. It should resolve this issue.
Comment 5 David Flogeras 2011-03-21 23:02:02 UTC
Hmm, it does not seem to be making the library symlink in /usr/lib(64) for me
Comment 6 Aaron W. Swenson gentoo-dev 2011-03-21 23:19:26 UTC
(In reply to comment #5)
> Hmm, it does not seem to be making the library symlink in /usr/lib(64) for me

I need more details, please. I don't have a 64 bit system to test the module on, so I had to make a couple logical leaps.

Where is it failing?
Where is the lib actually located?
Comment 7 David Flogeras 2011-03-22 01:47:33 UTC
It doesn't seem to fail, there just is not a symlink in /usr/lib64 (but the include symlink is correct it seems).

My libs are located in:
/usr/lib64/postgresql-9.0/lib64/libpq.so.*
/usr/lib64/postgresql-8.4/lib64/libpq.so.*

Just ask if you need anything else.
Comment 8 Aaron W. Swenson gentoo-dev 2011-03-22 03:37:14 UTC
(In reply to comment #7)
> Just ask if you need anything else.

You've been a great deal of help. Thanks for the quick response.
Comment 9 Aaron W. Swenson gentoo-dev 2011-03-27 14:11:15 UTC
eselect-postgresql-1.0.4 has been committed. Please review.
Comment 10 David Flogeras 2011-03-29 02:14:44 UTC
Hmm still not working for me. When I attempt to switch with 'eselect postgresql set 9.0' (or 8.4), I get something like:

Setting 8.4 as the default installation...                                      
        Removing old links...done.                                              
                Generating new links.../usr/share/eselect/modules/postgresql.eselect: line 190: /etc/eselect/postgresql/active: Is a directory                  
                done.                                                           


Not sure what the warning means, or if it's relevant.  Despite this, my /usr/include/postgresql and /usr/lib/libpq.so seems to be set correctly.


Also, my LDPATH seems to always be using 8.4's .so.  If I link a small test program (like int main() {} ) with g++ test.cpp -lqp

Then ldd ./a.out, I always see
libpq.so.5 => /usr/lib64/postgresql-8.4/lib64/libpq.so.5 (0x00007f073ca5e000)

Even if I have 9.0 selected for the test.

Hope that helps.
Comment 11 Aaron W. Swenson gentoo-dev 2011-03-29 02:20:24 UTC
Try:
    eselect postgresql update

That should clean up the remnants from <app-admin/eselect-postgresql-1.0.3
Comment 12 David Flogeras 2011-03-30 01:58:04 UTC
seems to have worked, all lib and include symlinks seems to set up correctly
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2011-04-01 15:41:33 UTC
*** Bug 361563 has been marked as a duplicate of this bug. ***
Comment 14 Jeroen Roovers (RETIRED) gentoo-dev 2011-04-01 15:42:43 UTC
*** Bug 359361 has been marked as a duplicate of this bug. ***
Comment 15 Aaron W. Swenson gentoo-dev 2011-04-02 12:08:32 UTC
  02 Apr 2011; Aaron W. Swenson <titanofold@gentoo.org>
  -eselect-postgresql-1.0.3.ebuild, -eselect-postgresql-1.0.4.ebuild,
  +eselect-postgresql-1.0.6.ebuild:
  Remove obsolete ebuilds. Fixes bugs #327441, 352147 and 292122.
Comment 16 Gerhard Hintermayer 2011-04-03 07:47:09 UTC
(In reply to comment #14)
> *** Bug 359361 has been marked as a duplicate of this bug. ***

I don't think this is eselect related (maybe only for compiling 3rd party apps
against postgresql-base) , the postgresql-server ebuilds shouldn't use the e.g.
/usr/lib/libpq libs but the libs of their corresponding slot. But they do this.
I mad this experience when emerging 9.0 with an active 8.1 slot. The links in
/usr/lib and /usr/include are all set up correctly, but still my
libpqwalreceiver.so was linked to the libpq from the 8.1 slot. So fixing wrong
symlinks is one story, but using the right libs at linking/emerging is another.
I already wrote im my (#359361) report, that I think the order of -L opts when
linking should be changed, i.e. slotted libs BEFORE /usr/lib, but I'm not a
gcc/makefile guru.

Gerhard
Comment 17 Gerhard Hintermayer 2011-04-03 07:48:22 UTC
"But they do this". should be But they DON'T do this. Sorry.
Comment 18 Gerhard Hintermayer 2011-04-03 10:16:32 UTC
(In reply to comment #17)
> "But they do this". should be But they DON'T do this. Sorry.

Shouldn't post that early in the morning ;-)  The original post was OK, so IMHO when linking a 9.0 slotted package, there should never ever be references to the (symlinked) libs of libpq of an other slot (was the case for libpqwalreceiver.so when I tried to emerge postgresql-server-9.0.3-r3 while having an active 8.1 slot installed)
Phew, now I got it right. :-)
Comment 19 Aaron W. Swenson gentoo-dev 2011-04-03 10:59:21 UTC
(In reply to comment #18)
> (In reply to comment #17)
> > "But they do this". should be But they DON'T do this. Sorry.
> 
> Shouldn't post that early in the morning ;-)  The original post was OK, so IMHO
> when linking a 9.0 slotted package, there should never ever be references to
> the (symlinked) libs of libpq of an other slot (was the case for
> libpqwalreceiver.so when I tried to emerge postgresql-server-9.0.3-r3 while
> having an active 8.1 slot installed)
> Phew, now I got it right. :-)

Please try these steps, and if the issue persists, open a new bug as the issue isn't as described on this bug:
    emerge =app-admin/eselect-postgresql-1.0.6
    emerge =dev-db/postgresql-base-9.0.3-r1
    emerge =dev-db/postgresql-server-9.0.3-r3
Comment 20 Gerhard Hintermayer 2011-04-03 16:32:55 UTC
Will try this tomorrow. 
BTW, someone linked my original bug report http://bugs.gentoo.org/show_bug.cgi?id=361563 as a duplicate to this one, but I think it is different.