Gentoo Archives: gentoo-dev

From: Paul de Vrieze <pauldv@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Berkeley DB, coexistence of different versions
Date: Wed, 14 Sep 2005 14:32:10
Message-Id: 200509141629.01746.pauldv@gentoo.org
In Reply to: Re: [gentoo-dev] Berkeley DB, coexistence of different versions by "Robin H. Johnson"
1 On Tuesday 13 September 2005 04:23, Robin H. Johnson wrote:
2 > On Tue, Sep 13, 2005 at 12:50:47AM +0200, Stefaan wrote:
3 > > Hi all!!
4 > >
5 > > Here's an issue Seemant and I have been struggling with, and doesn't
6 > > seem as easy to solve as like touching one ebuild.
7 >
8 > You're making the problem seem much larger than it is.
9 >
10 > Pauldv and myself have been managing berkdb pretty well, I haven't seen
11 > bugs on it in a long time.
12 >
13 > > Berkeley DB comes in many flavors. Judging by the slots in the
14 > > ebuilds (1, 3, 4, 4.1, 4.2, 4.3) there's many different interface
15 > > versions. This comes with the added fun of having packages depend on
16 > > certain versions of DB. Nothing shocking so far.
17 > >
18 > > However, looking at the heimdal-package we noticed several problems
19 > > (which seem to be more widespread than just heimdal):
20 >
21 > [snip]
22 >
23 > Fix your package to compile with any version of db, that's the general
24 > approach that has been taken so far, and it's been largely successful.
25 >
26 > You should use these libraries and headers:
27 > /usr/lib/libdb.{so,a}
28 > /usr/include/db.h
29 >
30 > If you want to limit it to a certain reason of DB for some other
31 > reason, then consider /usr/include/db1, /usr/include/db3,
32 > /usr/include/db4, /usr/include/db4.X.
33 >
34 > And use the unversioned functions (db_create instead of
35 > db_create_4002). To deal with the varying number of arguments, have a
36 > look at
37 > PHP/nss_ldap - the fix is pretty simple, just an extra argument if the
38 > version is 4 or newer (IIRC, but check).
39 >
40 > Detection of some specific version is bad! Just figure out what major
41 > version, and do the correct thing for that series.
42 >
43 > In a bunch of cases, the best approach has been to just rip out
44 > upstreams stuff from configure.in, and write it properly, and submit it
45 > back to them (definetly see PHP4 in this regard).
46 >
47 > Also take a look at db4-fix.eclass.
48 >
49 > You claim the interface versions have changed, but the code is still
50 > largely compatible. What's a larger issue is the fact that you can
51 > upgrade an existing database, but not downgrade it.
52 >
53 > If you are stuck updating the package for this, then give me or pauldv
54 > a shout.
55
56 The major issue with berkeley db is only that we build using "versioned
57 symbols", a setup that prevents header/lib mismatches and allows
58 different library versions to coexist in one binary (a situation that
59 unfortunately happens with db as it's not strong on binary compatibility.
60 Version 4.3 however does not offer this symbols anymore, which is the
61 main reason it is masked. If you want to do some nice work you could work
62 on using linking scripts to do versioning properly (and use the ELF
63 versioning system). That leaves the poor detection of db packages by
64 other packages/configure scripts. Unfortunately many configure scripts
65 are just broken. The proper name of a library name according to the
66 standards for library names is db-4.2.so, db-4.so and db.so to exist for
67 all versions. A package should try to look for the most appropriate one
68 of those, but many configure scripts look for redhat-isms like "db4.so".
69
70 The db.eclass maintains shared info by all db3 and db4 versions such that
71 /usr/include/db.h and /usr/lib/db.so allways point to the most recent
72 version of db installed.
73
74 On the configure scripts, the best approach is to have a test program that
75 includes the db header and then checks whether the header and library
76 versions are equal. The problem with checks for db_create is that this
77 function is called db_create4002 for db4.2 and this mapping is provided
78 in the header file. If the header file is not included in the test
79 program, the test fails.
80
81 Paul
82
83 --
84 Paul de Vrieze
85 Gentoo Developer
86 Mail: pauldv@g.o
87 Homepage: http://www.devrieze.net

Replies

Subject Author
Re: [gentoo-dev] Berkeley DB, coexistence of different versions "Diego 'Flameeyes' Pettenò" <flameeyes@g.o>