• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

Why isn't there a LIBPATH environment variable?


Luna Crane

I know /etc/profile has a PATH variable for binaries, and during configuring a program you can specify "--prefix=/usr --libdir=/usr/lib64" , but these are not usually properly functional (often don't listen), especially when using 32-bit compatibility libraries. The number 1 problem I have in installing programs is getting them to properly find and identify the right libraries on my system. My question is, why isn't there a LIBPATH environment variable that specifies where a binary should look for libraries on the fly, independently of the program's location?

It's already an issue that many of the lib names are non-standard: In essence, /lib can contain 32-bit or 64-bit libraries depending on the system. Many programs don't even consider the more accurate /lib32 + /lib64 setup, and most distros don't either.

Programs and scripts should, for the most part, install anywhere + run anywhere, no matter the distro's specific setup, even if that may mean generically-compiled binaries and libs are included with the program. Furthermore, there shouldn't be a conflict in choosing between system-wide installed libs and libs included with the program. The only way I see to do all of this is a separate LIBPATH environment variable, much like the PATH variable for binaries. I think it could solve many of the incompatibilities between many distros and their packages (even more so than converting packages).

I doubt I'm the first to consider such a thing, so is there a reason there isn't a LIBPATH environment variable?

There is a variable that contains Library locations. It is called LD_LIBRARY_PATH which is used during compile time.

For runtime libraries ldconfig is used. ldconfig will create a cache of libraries it is told to keep track of. You can edit /etc/ld.so.conf to include more.

For more information: http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

If bash is your environment shell you can use the following command to view all shell variables:

By the way, you are talking to the Linux community. Trying to tell us how to do things without properly researching will only cause us to laugh at you. We do things our own way.
Last edited:
I actually have LD_LIBRARY_PATH among my library problem fixes, but I've found it to be unreliable, but that may be because I could have been using it wrong, since I've had to pick up info about it on randomly scattered sites, with varied and often unclear info about it. That tutorial site should help. I'm hoping all programs rely on it instead of maybe more or less hard-coding locations.

If only man pages were actually consistently understandable, and good, clear, easily understandable, and extremely reliable resources on full Linux use were readily available in one place, which everyone could reference and wont disappear at happenstance.

Excuse me for coming up with a concept that already exists. I'm not telling anyone how to do anything, and you should never assume so, especially when people come here looking for answers to their questions. I was trying to relate the idea/concept of how programs could logically relate information without relying on absolute locations. This is after years of dealing with programs that have bad (by anyone's definition) configuring setups, and struggling to change hard-coded locations in config and make files.

People ask because they want to know. People suggest because they want to solve a problem. I don't see any reason why you or anyone should be laughing at that ... unless you're trying to drive people away [from Linux]: in that case, be my guest, go ahead.

Members online