LD_LIBRARY_PATH is no longer set or exported on my 11.3 x86_64 system. What sets this and where is it set? I may have caused this by updating devel:gcc from 11.3 to factory. I have since tried to restore this to 11.3, but the problem still exists.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It can be set by anything as it is just an environment variable. Feel
free to set it again and maybe set it for all of your shells in ~/.profile
so that it is automatically set in the future. Many scripts which start
applications will set it for those applications which you won’t see until
you run them and then look at that application’s environment.
What is the symptom resulting form this change in your case, if any?
Good luck.
On 08/22/2010 04:06 PM, jschwartzman wrote:
>
> LD_LIBRARY_PATH is no longer set or exported on my 11.3 x86_64 system.
> What sets this and where is it set? I may have caused this by updating
> devel:gcc from 11.3 to factory. I have since tried to restore this to
> 11.3, but the problem still exists.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJMccrIAAoJEF+XTK08PnB5+3QQALBUtHncZ47TG2+fCgmCEjej
NeaMl5gqFF8DfCAXznYBHW3C+l0l1ywBmRunDcLrAhFqz8QZ9oWQKPPrhGXSKlLi
6tUCYQIBB/PxdjLXB7fBypcAhs69dZba8iLLc4i7+L9AT7m+8OWHY1oWO38JOSnL
8ZlRezrpU4A7D10VwAGr7xs7xxtvXUgovk1rXYt6w6NqMakxZfSsHLh6+Ck8s7ZT
r+9YRahK4dj2Kh6ohcPNUueUUMQox4BU38e0KzYN4Liffmnwt0kaZyvgNdrHYpYP
EzBb81ht7RU0k3apXIlXToLtHkLUb547BKIi2UtiVqvau6+01pxFXBJwaoCDxknA
0EqA/qpdpCU44A4DRF4v8U+CkKvyzl/Jrpi1Y0uYlbehqc3BZ0xyjIHJ6K+y8+Am
E+A9W/wf7q9soUzQ9akPyJwiiMr4HHMpvc7lLP2LIKFWvklX3Ku64xrS5Rsm0+nQ
OazMmRX+B//x//LZGVtZTVITYm1+T5rxpyLZdre/MN/xyvuC5ecZVIxOU8eIqSqs
3a98IRpb0Vfqz56JYKa/qEBzmrap0ubfPrbHJYNFY3r3hvunIa/NKkifINusI+Nf
fnea8SgBNAuWBQey22q2QCNLh2BAGgDA5Z4wJVvtW97isFj9UtHGPeyf/f6bL2Fw
aKwRPqt+PYPnb/pNEfuF
=xQUf
-----END PGP SIGNATURE-----
Thanks.
I had written a utility to append some development locations to LD_LIBRARY_PATH and display the result. This stopped working when LD_LIBRARY_PATH was no longer exported. I can set LD_LIBRARY_PATH, but I was afraid I might be losing some default values, or losing my custom values when something changed it. Should I export LD_LIBRARY_PATH=’/user/lib:/usr/local/lib’ or are these added by default?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This is a fair question and the answer is… it depends. Welcome to life
I suppose.
So what does it depend on? It depends on where the system looks for C
libraries by default, which is all that LD_LIBRARY_PATH does.
Understanding this may be something you know implicitly but let’s cover it
a bit.
LD_PRELOAD - Points to a specific file (or files? I think so) to be
preloaded and which has priority over all other libraries. This will
override libraries that would otherwise be use.
LD_LIBRARY_PATH - Points to a directory or directories (colon-delimited)
where the system should look for C libraries. This is useful for specific
applications that need libraries that should not be exposed to the entire
system. Development systems use this a lot; applications with a ton of
libraries that are otherwise not useful to the rest of the system use it
too. The benefit of not having these system-wide is performance, and
sometimes (development), stability.
After those we have the system’s cache of libraries which is built at
startup via ldconfig and which is maintained via /etc/ld.so.conf (and
potentially other files included by that configuration file, such as the
contents of /etc/ld.so.conf.d/ on SUSE and other systems). This is where
applications typically look for shared libraries and is available
system-wide by anything that understands C. This cache is managed by the
ldconfig command which you can run whenever you want to rebuild things.
The libraries available are mentioned in /etc/ld.so.conf which anybody can
view. You CAN modify this file, but typically (at least on systems that
support it) it is better to modify the files (by adding new ones) in
/etc/ld.so.conf.d/ so that you do not lose changes during upgrades.
So in your case your question was, should you have /usr/lib and
/usr/local/lib included in your LD_LIBRARY_PATH? That would be required
IF you did not have these as part of your system cache, which you almost
certainly do (that’s the whole point of those directories). To verify you
can look in /etc/ld.so.conf which, in my case, has the following entries
(note my laptop is x86_64):
/usr/local/lib
/usr/lib64
/usr/lib
/usr/local/lib64
So you should be fine and should not need to define these explicitly since
they are part of the system default.
Good luck.
On 08/23/2010 10:05 AM, jschwartzman wrote:
>
> Thanks.
>
> I had written a utility to append some development locations to
> LD_LIBRARY_PATH and display the result. This stopped working when
> LD_LIBRARY_PATH was no longer exported. I can set LD_LIBRARY_PATH, but
> I was afraid I might be losing some default values, or losing my custom
> values when something changed it. Should I export
> LD_LIBRARY_PATH=’/user/lib:/usr/local/lib’ or are these added by
> default?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJMcqPUAAoJEF+XTK08PnB5q5MP/2OPNpACezXtZRRY2LomqsGd
JJi0vYW+6HtDjLc+bKlS7A4cvMyrLHPRDymNVbeD1FWyI6W0fUpE/K03l5Ix+Ea7
e+am0binwTG1FDIAzCtlNb1rTXgErkbJ7FrCEhfFtFUPHS209DT+6yyrOlgQTZz3
xev1da5m9g+EVm5J//Dv3khzIyWU+Y18+YJQRJageU93x3b/j+Kv9T+ZJ9yHFV/w
hrWcoYwSv2So7txQ3APpgttKT4zgaPbypJigK+RP2CzgwVYE64qrYcCZkKOiH6mg
9gKyU9MDbbDIsBnDLpTvS+5Yo0/M4e2JKYyYjJLdkQCypqwzlct+f+jurFVDQWkO
5NYNWNhWX28AHTwU+dXxTgOJxlMm27igb+4DfdiLk6VA8qRU8H5JULDd9iOgUOc3
EbWUn5miVODytF/dNmbB1FyLX7+YDIxw3ycFVMINyJNVX9QsvSXfB3Ym4Z/wcH6j
7Lh7glS9h2SyfFggEtrNADmFN87QTm9Gnku0+zvvrI+pIVPYxSqB9H10X8OAk0hC
x1u8V36MAzWuqHyLWB0vlcPuDjXWnZXTcfWA6QflO+rdVcjUA89tF6S3/mIzOKR+
kHoncV9Hxs83GORVa9MKumj6V9BZX3IOUXdJacUWjC0+Bs3kjibOrGdicit7zOqK
c20oEBnWddUgqrauOE2g
=MNe/
-----END PGP SIGNATURE-----
Thanks for a very clear explanation. I’m now simply exporting an empty LD_LIBRARY_PATH and adding my development library path to it as needed.
It’s usually a Bad Thing™ to have empty entries in LD_LIBRARY_PATH, like leading/trailing colons, or ‘::’ inside; this is treated as if it were a ‘.’, and search wherever you happen to be cd’ed to. Can make debugging really nasty. Definitely bad for ‘root’ :-).
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I’m glad you brought that up, as I’d never thought it worked that way
before (sure, with a dot it would, but with a blank context? That’s
annoying).
http://stick.gk2.sk/blog/2009/10/wrong-usage-of-ld_library_path/
With that in mind I know of some products that do this; off to report some
bugs.
Good luck.
On 08/23/2010 02:06 PM, GeoBaltz wrote:
>
> It’s usually a Bad Thing™ to have empty entries in
> LD_LIBRARY_PATH, like leading/trailing colons, or ‘::’ inside; this is
> treated as if it were a ‘.’, and search wherever you happen to be cd’ed
> to. Can make debugging really nasty. Definitely bad for ‘root’ :-).
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJMctmdAAoJEF+XTK08PnB5KQ8QAIiHi8ow+0dnJm+/ZU8TO5XJ
wwkbFqcQa+F0uXfWTtf775JkH56+628Glpe8wl+1K+6q4+njPr12SVe4NBvkZLS9
vUOz/2XUgpoLAPLsYoCb4DdWPg9aHo6tBc3JfwEYPlJu5kkJ4zTLmsWNRPZcwCau
LPuO13M1QvyHtZH038P2QCSXlGfaeyDRmmho6L5ZMKqF9P3UYJ7G8D4kQGW0cySz
q7yPIf69WjVJZuZMv0MAF+I3eWnsBLcpTLedxYKcyJewnkoMOdFelGbeBUMZkCFA
e3jlApB0kGp++iTnKjSsQdgfmBxpRpMcvaVDhDNy7yglGZ/z3xVTFkv4n4y03959
by8ZVeHJj4JTg/QBGHkF5hekMcrIKD/jUruJqVxmK8mLKsQ9uBMZi1cY+jrV0xN1
5mkSjFKCYsjRfMdRDPcgNn6+J+E+M8k97ySanuR2uMcabF1gjcXgvstL8PmcCZcR
LmHui3+1Hay0xkf/0lnjYU/rxROzAH9qju5oyMMztURIHfgTEAO8wjrG2Y2BqkTY
pVKd8vqndtH/8/gT9WGnsXqhv/GtK0GnJSwRLx7hOukGn4X+dsLLgzEzjEzkWems
Wcwyzia/nv2JnvUW/SMFJQT0OMwWlS4BiD5k8KoSlLHY+VG8mCIPQ9zJVD/NYyhY
tat+D1eXhKkdbjl0LZVg
=DHCh
-----END PGP SIGNATURE-----
Thanks for the additional input. So as a general rule:
- Don’t export LD_LIBRARY_PATH until you need it.
- Restore LD_LIBRARY_PATH to its original value when it’s no longer needed (unset LD_LIBRARY_PATH if it was originally empty).
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- Yes, well, maybe. Usually when I modify the variable it is in a
script used to start an application and not in a shell I am using
actively. As this is only an environment variable it is specific to a
single environment and not used system-wide so in these cases there is no
reason to unset/revert the value after running the program (the script
ends, the environment is destroyed, life goes on). If you are using it in
a single shell and changing between applications that you are customizing
the variable for each time then it probably makes more sense.
Good luck.
On 08/24/2010 02:06 PM, jschwartzman wrote:
>
> Thanks for the additional input. So as a general rule:
> 1. Don’t export LD_LIBRARY_PATH until you need it.
> 2. Restore LD_LIBRARY_PATH to its original value when it’s no longer
> needed (unset LD_LIBRARY_PATH if it was originally empty).
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJMdCxBAAoJEF+XTK08PnB5G8AP/R2HeYi3ZRiKZSGfbSgZv5dt
TfU6IH/Pal3/0AHAtBTIZEyRcZjfSxdWmfkqW/FdWChqzPU9aGcr0yYVuZtln9Fo
9WlXSNRbiOfzBYF9q5+lFI/f4C+UYdwaVV6z7buOd/pn8f3f3YHRsNqvcq1/L4v4
XFfz9z7N8rCzMurNT/UwR0EbhkTzKNGjQ7eM7m2kEdcUySYz0WR6v8AZ0mT7nF26
V3hT8MSRZMAyb9r00KosJbMtMsYwescN+nu6nAT4L42e/TAb62Q3sWxg2YFaWg/l
13BJeVkbzrMKO+8+XEZAS2sg4YMqKzTqByhfD699+07DfV6t4rBHpEf+msa5aJak
Uuwva660Se8Jo749IL/qZnbjztmEYUXnsxLz3JYAvIf4AQRvRJreycPkdBgyrbIK
i1yjy8+VM3ommPVjCiQFI5EB5jECFCugc/cC1fGult7idUt0Vhn/NaSwSoTlLEn+
9xVRBo/PrN+14xoRA07A9mlOg0HB9kC00ZKqqF4WuGPostSBkNXVGF09h1wNuy28
jMm4QpqHJWKKDge2OldwYZI6WhqEcRNvEClCtEoAHWjo3/T5Uk+B4u8dJzTVEGtc
ZQL69UkBDGRkEk5dMX9AcCTMBwbRB0ehjojX6RLwDBAzDYwVNLZ7vaeDLyJv2xdo
fh1kET8oD1++ZtYYwvhQ
=2Ogd
-----END PGP SIGNATURE-----