Time
8 hours 30 minutes
Difficulty
Beginner
CEU/CPE
10

Video Transcription

00:04
Welcome to 102.3,
00:07
managing shared libraries.
00:10
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?
00:16
And how do we get some of the details about these
00:20
files in our systems?
00:23
So look at a few commands to do this and environment variable
00:29
Now, the shared library
00:31
idea is
00:34
that a program that gets built
00:39
might use a different life system libraries for various functions that the program performs.
00:46
But there might be all the other software on that system, which also can use that same library for those functions.
00:52
And that's the reason why they're shared. It's a It's a resource made available to multiple
00:58
different pieces of software.
01:00
And
01:00
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.
01:11
These are typically located and slash liver slash lips 64
01:15
for 64 bit systems.
01:19
Now, when library ecstatically linked,
01:21
this means that
01:23
all of the pieces that are needed for that program to operator all in one package. One piece.
01:30
So we're static. Linking means that were basically embedding the library with the program to run as more single unit
01:37
dynamically linked means that the library is referenced somewhere on that
01:42
system. Underneath slash liver slash lived 64.
01:47
So,
01:48
uh, there's a little bit more of a complex set up for dynamic linking to a library. But
01:53
it's a really easy to deal with
01:57
now for a particular program. For instance, if you were
02:00
doing an update or doing a patch, you might have to verify which libraries are referenced by some piece of software.
02:08
So
02:10
if we run this, if you're on our command here, we can see that
02:15
I can run the
02:19
get man pager
02:21
L d d prints my shared library dependencies,
02:25
and I'll use the dash V option
02:29
to, uh,
02:30
a little bit more information So I can just specify any executed all file like Espen if config.
02:38
And this shows me all the different libraries which
02:42
are used by this particular
02:45
Byner
02:46
and you'll see I've got,
02:47
uh, lived 64 Lipsey dot s 0.6.
02:52
There's also lived 64 lb Lennix *** City for God s soda too.
02:59
A few other ones specified here.
03:00
Uh, actually, these are all referencing the same lips. Egan eso 0.6 at least for that little section
03:08
and then lib si eso 0.6. Also, it references other library files. So it does give me
03:15
some good could detail there
03:21
If I run it without the V option, I get a more abbreviated output. But you get the idea
03:25
very handy,
03:27
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.
03:40
So these are things thio to consider
03:46
now, beyond the
03:49
simple
03:50
reference of which libraries are required by some buying our program,
03:54
we could also figure out where they're actually located.
04:00
So there's a dynamic library directory, which we see here at C. L. D s o dot com.
04:05
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.
04:13
So let's go ahead and have a look at those
04:20
so I can run a locate command against Lipsey. That s 0.6.
04:27
And since it's within my search path, locate command tells me where that ISS
04:35
And if I want to look at a, uh
04:38
along listing
04:42
groups
04:50
in trouble typing now I can see where the symbolic link actually points.
05:00
So this way I can reference we'll talk a little bit more about links later. But,
05:05
uh,
05:06
this is a way to
05:10
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.
05:17
Now, if I go to the directory,
05:23
I'm in at C L D s own account I d. That's probably configuration files are.
05:28
And I've only got a handful of items here, but I can look at,
05:31
for instance, my eye scuzzy config file, and it tells me where the driver is.
05:40
Maria Database.
05:42
I've got to use your lips 64 my sequel, something Maria database, which we'll see later,
05:46
uses this shared library for my sequel.
05:50
It's very easy to see how this all fits together,
05:54
hopefully becoming he's risking out this fits together
05:58
now as an administrator.
06:00
Sometimes shared libraries are not available when software needs them,
06:05
so you can use the LD convict load.
06:09
Um,
06:10
we're told to look at the contents of the cash,
06:12
and then we could just specify the environment, variable of LD library path
06:16
and in order to point to some other area where libraries might exist
06:23
and usually with the reason that this kind of situation happens is that,
06:28
for instance, if I run LD config
06:32
Dash P. That shows me the contents of the
06:35
cash. So these are all the libraries that are currently cashed and available to any operating system program or any other software
06:43
with the appropriate physical location on the file system,
06:47
you can see there's quite a few
06:50
items there.
06:53
1191
06:55
a lot
06:56
I ran LD Config Dash P and I did was I piped the output to the word count program.
07:02
Let's let me count the number of lines. We'll cover that little bit later, but it's a very handy feature.
07:10
Do you consider
07:12
now
07:13
within my shell I could run the envy command that shows me by environment variables.
07:17
If I run the envy and I grab for
07:21
L D
07:24
library path.
07:28
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
07:34
huh
07:35
software.
07:38
However,
07:39
it is possible that
07:42
when you're installing third party applications and I've seen this in my production support experience where
07:46
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.
07:59
So what I can do is
08:03
I can change the
08:05
library path
08:07
and add these other directories as needed and then just export that variable. It's just in a
08:13
a shell variable like any other.
08:15
Once that variables been exported, then it becomes available for
08:18
other programs to use. We can see what that export command might look like.
08:24
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
08:35
when shared libraries are needed by software.
08:39
All right, so this is some of the command that we looked at the, uh
08:43
of locating the dynamic
08:46
shared libraries
08:48
looking at the config files, looking at the config God directory.
08:52
And we also touched on the loudy library path.
08:58
All right, so the next section that we have is getting into two debian package management,
09:05
So I'll see you in 102 dot for just a little bit. Thank you.

Up Next

CompTIA Linux+

Our self-paced online CompTIA Linux+ course prepares students with the knowledge to become a certified Linux+ expert, spanning a curriculum that covers Linux maintenance tasks, user assistance and installation and configuration.

Instructed By

Instructor Profile Image
Dean Pompilio
CEO of SteppingStone Solutions
Instructor