Welcome to 102.3,
managing shared libraries.
So it's a short little section. But what we need to talk about here is what is a shared library, actually for what is its purpose?
And how do we get some of the details about these
files in our systems?
So look at a few commands to do this and environment variable
Now, the shared library
that a program that gets built
might use a different life system libraries for various functions that the program performs.
But there might be all the other software on that system, which also can use that same library for those functions.
And that's the reason why they're shared. It's a It's a resource made available to multiple
different pieces of software.
this is a very convenient way of buildings off because if if you need to make changes to a library off the applications that reference, it will be able to reference that new version.
These are typically located and slash liver slash lips 64
for 64 bit systems.
Now, when library ecstatically linked,
this means that
all of the pieces that are needed for that program to operator all in one package. One piece.
So we're static. Linking means that were basically embedding the library with the program to run as more single unit
dynamically linked means that the library is referenced somewhere on that
system. Underneath slash liver slash lived 64.
uh, there's a little bit more of a complex set up for dynamic linking to a library. But
it's a really easy to deal with
now for a particular program. For instance, if you were
doing an update or doing a patch, you might have to verify which libraries are referenced by some piece of software.
if we run this, if you're on our command here, we can see that
I can run the
get man pager
L d d prints my shared library dependencies,
and I'll use the dash V option
a little bit more information So I can just specify any executed all file like Espen if config.
And this shows me all the different libraries which
are used by this particular
and you'll see I've got,
uh, lived 64 Lipsey dot s 0.6.
There's also lived 64 lb Lennix *** City for God s soda too.
A few other ones specified here.
Uh, actually, these are all referencing the same lips. Egan eso 0.6 at least for that little section
and then lib si eso 0.6. Also, it references other library files. So it does give me
some good could detail there
If I run it without the V option, I get a more abbreviated output. But you get the idea
especially when you're doing development work and doing troubleshooting. And you trying to figure out where. Is there something broke? And maybe I can look at these libraries, figure out where something went missing. Maybe I don't have the environment variable set correctly and so on.
So these are things thio to consider
now, beyond the
reference of which libraries are required by some buying our program,
we could also figure out where they're actually located.
So there's a dynamic library directory, which we see here at C. L. D s o dot com.
And then there's configuration files underneath. At C. L. D s o dot com dot d. It's kind of a mouthful when you say it like that.
So let's go ahead and have a look at those
so I can run a locate command against Lipsey. That s 0.6.
And since it's within my search path, locate command tells me where that ISS
And if I want to look at a, uh
in trouble typing now I can see where the symbolic link actually points.
So this way I can reference we'll talk a little bit more about links later. But,
this is a way to
have pointers to a file that can exist in multiple places. It's very convenient for for situations like this where I have a shared library.
Now, if I go to the directory,
I'm in at C L D s own account I d. That's probably configuration files are.
And I've only got a handful of items here, but I can look at,
for instance, my eye scuzzy config file, and it tells me where the driver is.
I've got to use your lips 64 my sequel, something Maria database, which we'll see later,
uses this shared library for my sequel.
It's very easy to see how this all fits together,
hopefully becoming he's risking out this fits together
now as an administrator.
Sometimes shared libraries are not available when software needs them,
so you can use the LD convict load.
we're told to look at the contents of the cash,
and then we could just specify the environment, variable of LD library path
and in order to point to some other area where libraries might exist
and usually with the reason that this kind of situation happens is that,
for instance, if I run LD config
Dash P. That shows me the contents of the
cash. So these are all the libraries that are currently cashed and available to any operating system program or any other software
with the appropriate physical location on the file system,
you can see there's quite a few
I ran LD Config Dash P and I did was I piped the output to the word count program.
Let's let me count the number of lines. We'll cover that little bit later, but it's a very handy feature.
Do you consider
within my shell I could run the envy command that shows me by environment variables.
If I run the envy and I grab for
I don't have anything configured because I'm not part of my environment. If I'm not a developer, if I'm not, perhaps installing
it is possible that
when you're installing third party applications and I've seen this in my production support experience where
you have to install some software but the shared libraries that it's referencing and the ones that it's needed are not in the standard locations like slash live slash slash lives 64.
So what I can do is
I can change the
and add these other directories as needed and then just export that variable. It's just in a
a shell variable like any other.
Once that variables been exported, then it becomes available for
other programs to use. We can see what that export command might look like.
I've got some existing library paths, and maybe I've got some additional ones in my home directory so I can export this, and now those will be within my search path
when shared libraries are needed by software.
All right, so this is some of the command that we looked at the, uh
of locating the dynamic
looking at the config files, looking at the config God directory.
And we also touched on the loudy library path.
All right, so the next section that we have is getting into two debian package management,
So I'll see you in 102 dot for just a little bit. Thank you.