[Zope] Re: Learning Linux and more (was: MySQLDA and MySQLdb probs and solns )

Patrick Phalen zope@teleo.net
Sun, 2 Apr 2000 12:21:13 -0700


[Eric L. Walstad, on Sat, 01 Apr 2000]
:: I couldn't find any info on LD_LIBRARY_PATH.  Can you point me in the right
:: direction?

Once again, this is not a Zope question. I hesitate to get into this,
because this is a (busy) Zope list, not a Unix system administration
list. Also, because, like all things Unix, there are numerous ways to
approach this and all Unices are a little different in this regard. So
I'll confine this to the Linux case and also to my own preference. I'd
encourage you to find out more on your own, in order to have the
greatest flexibility. There are newsgroups for this subject.

LD_LIBRARY_PATH (load library path) is a shell environment variable. As
you may know, you have some built-in variables such as HOME
and PATH. Others, like TERM, are not built in, but are so common that
they are likely to be in your environment by virtue of being set in
/etc/profile or elsewhere. It's A Good Idea to find out where all
of yours are coming from.

Any variable can become an environment variable. In the
particular case of Linux, your default shell is Bash. In Bash, unlike
csh and descendants, putting a variable in the environment entails
defining and then exporting it. Doing so would be useless unless
some program actually looks for that variable in the environment. In the
case of LD_LIBRARY_PATH, that program is ld.

If you haven't done so already, type 'man ld' and 'man ld.so'

ld.so has the job of searching for shared library files.
/etc/ld.so.conf contains a list of directories it searches. By default,
ld.so always searches /lib and /usr/lib, regardless of the contents of
ld.so.conf. Usually, there's no reason to modify ld.so.conf and many
seasoned sysadmins will tell you to never modify it. Use LD_LIBRARY_PATH
instead; that's what it's for.

Type 'export' from the bash shell without arguments to see what
environment variables you have right now. This is generally a good
first step, for reasons I'll explain in a moment.

In the Linux case, you can set and export LD_LIBRARY_PATH from the shell
prompt, prior to any compilation attempt.

LD_LIBRARY_PATH=/foo:/bar:/spam:/eggs

export LD_LIBRARY_PATH

For other variables, you may find that 'export' reveals that you
already have a path in your environment and you may choose not to
tromp on it. In that case, you can append to it:

varname = varname:/extrastuff

If you want a permanent repository for this (if bash is your shell),
$HOME/.bash_profile is the place.

/etc/profile is looked to first for all users, but your HOME
environment takes precedence in this search.


:: Thanks for the pointers!  I still think the mailing lists are the best
:: resource!

Why, because it's easier for you? Expect to eventually get flamed if
you:

!. Don't RTFM.
2. Post off-target questions.