|
From: Will P. <pa...@dc...> - 2005-11-21 19:52:17
|
Following on from some of Jim Rowan's recent experience (and mine),
I'm rethinking some of the Sidai way of dealing with shared
libraries...
Context ... The old traditional way was: build a library, throw it
into /usr/local/lib, put /usr/local/lib in your LD_LIBRARY_PATH, and
off you go. Good: easy; bad: /usr/local/lib becomes a mess and (if
you're not careful) a bit of a no-go area ("Don't delete anything, you
have no idea what program relies on that.")
Reaction, the Sidai way: Libraries get built, put into (something
like) /our/.-ark-deploy/<package>--<version>/lib, and everything that
needs those libraries gets linked with "-R
/our/.-ark-deploy/<package>--<version>/lib". Good: you're being
Really Explicit about what you want; bad: it's a bit of a pain, and
it's hard to replace a library with a simple improvement (e.g. one
security fix).
You've also got to get GCC to cooperate... it links a shared library
libgcc_s.so into lots of things. So, in building GCC, we 'sed' the
so-called 'specs' file to produce one that inserts a "-R
/our/.-ark-deploy/gcc--4.0.2/lib" (for example) into every link
invocation.
Ugly, but it used to work :-( Recently, Jim reported that it didn't
for him; when I just built gcc 4.0.2, it doesn't even *have* a
deployed specs file! (I think the specs must get wired into the 'gcc'
binary, or something.)
Now, there's another mechanism for this kind of thing, namely setting
up ld.config (or equivalent). You tell the runtime linker "here are
some places to look for shared libraries", and then it does the rest.
So, for example, I did [on a Sun]...
sudo crle -l /usr/lib:/our/.-ark-deploy/gcc--4.0.2/lib
... and my libgcc_s problems went away forever :-)
Now, it's quite easy to play this ld.config game so that it's just as
ill-disciplined as the "throw it all in /usr/local/include" game. But
surely there is a way to gain most of the discipline of the "I'll tell
you _exactly_ what I want" -R'ing scheme. Something like... each
package providing libraries has a field...
<ld-config-spec>
<param name="prefix">!sidai_prefix</param>
<string>$prefix/lib</string>
</ld-config-spec>
... and some small program comes through and collects these, and sets
ld.config appropriately.
I haven't done all this yet, but am seriously considering it. Love to
see all that -R stuff go up in smoke. Thoughts?
Will
|