Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is ldconfig (or anything similar) required after the installation of shared library?

After a shared library (.dylib) is compiled and is put into an appropriate directory, is "ldconfig" or a similar command required to finalize the installation?


On Linux, each time a shared library (.so) is installed or uninstalled, /etc/ld.so.cache must be updated by running the "ldconfig" command. Does Mac OS X require "ldconfig" or a similar command after the installation or uninstallation of a shared library (.dylib)?


Note that a shared library may also be called a shared object (so), a dynamically linked library, or a dynamic-link library (dll).


Thanks.

Posted on Mar 31, 2012 9:31 PM

Reply
3 replies

Apr 4, 2012 11:23 AM in response to etresoft

The following excerpt explains why Linux uses "ldconfig" after the installation or uninstallation of a shared library.

http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html


| On Linux systems, this loader ... finds

| and loads all other shared libraries

| used by the program.

|

| The list of directories to be searched

| is stored in the file /etc/ld.so.conf.

|

| Searching all of these directories at

| program start-up would be grossly

| inefficient, so a caching arrangement is

| actually used. The program ldconfig(8)

| by default reads in the file

| /etc/ld.so.conf, sets up the appropriate

| symbolic links in the dynamic link

| directories (so they'll follow the

| standard conventions), and then writes a

| cache to /etc/ld.so.cache that's then

| used by other programs. This greatly

| speeds up access to libraries. The

| implication is that ldconfig must be run

| whenever a DLL is added, when a DLL is

| removed, or when the set of DLL

| directories changes; running ldconfig is

| often one of the steps performed by

| package managers when installing a

| library. On start-up, then, the dynamic

| loader actually uses the file

| /etc/ld.so.cache and then loads the

| libraries it needs.


How does Mac OS X deal with this issue?


Linux uses the cache file "/etc/ld.so.cache" to avoid the redundant search of directories. Linux uses "ldconfig" to update the cache.


How does Mac OS X avoid the inefficient redundant search of directories?

Is ldconfig (or anything similar) required after the installation of shared library?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.