Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purging and rebuilding ldconfig cache?

I am trying to purge the ldconfig cache of links to libraries to link against. I have a local folder where newly built libraries are placed. I want to update the ldconfig cache to point to these newly built libs.

I have tried using the ldconfig -c command, giving it my own .conf file. I also tried replacing the /etc/ld.so.conf file to point to the new path of libs. But even after doing this, when I check the cache using the ldconfig -p command , it is still showing the old libs.

Hence how to purge and rebuild the ldconfig cache? Just to add : I am on Ubuntu 13.10.

like image 304
eminemence Avatar asked Feb 13 '14 15:02

eminemence


People also ask

Which tool is used to update the ID so cache file?

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld. so.

What is ld.so cache?

so. cache, which contains a compiled list of candidate shared objects previously found in the augmented library path. If, however, the binary was linked with the -z nodeflib linker option, shared objects in the default paths are skipped.

What is Ldconfig command?

The Linux ldconfig command creates, updates, and removes available symbolic links for currently shared libraries. The symbolic links are based on lib directories in /etc/ld. so. conf. Linux commands rely on shared libraries.

How does ld.so work?

When a program linked with shared libraries runs, program execution does not immediately start with that program's first statement. Instead, the operating system loads and executes the dynamic linker (usually called ld.so), which then scans the list of library names embedded in the executable.


2 Answers

2 years late, but in case someone stumble upon this, as su (not as sudo), run the following commands:

rm /etc/ld.so.cache ldconfig 
like image 150
codenamezero Avatar answered Sep 23 '22 09:09

codenamezero


Rebuild cache

Open the /etc/ld.so.conf as sudo and add a new line with the library directory. In this case, we add /usr/local/lib. Rerun ldconfig to rebuild the cache:

$ sudo ldconfig 

This worked for me.

like image 34
Karthik M Avatar answered Sep 26 '22 09:09

Karthik M