LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to change the script of an executable? (https://www.linuxquestions.org/questions/programming-9/how-to-change-the-script-of-an-executable-532490/)

Nishant Desai 02-26-2007 05:16 AM

How to change the script of an executable?
 
Dear All,

In my /etc of ARM Linux, there is no ld.so.config file and there is no ldconfig command running, there is ld.so.cache which is binary executable, but there is no command like ldcache to run this file.

Then i create the ld.so.conf file in which i wrote the names of the directories where my shared object libraries are lying (like /lib,/user/lib) and i execute ./ld.so.cache (It could be that i am doing wrong) which infact runs my ld.so.conf file and it shows that /usr/lib is a directory (ofcourse ./ is to execute binary files).

how to create the ldcache command to execute ld.so.cache, how can i know that from which file ld.so.cache file has been generated? so that i can change it and can load my shared object libraries at the initialisation time.

Any input will be appreciable.

Thanks,
Nishant

alienDog 02-26-2007 10:25 AM

Quote:

Originally Posted by Nishant Desai
...how to create the ldcache command to execute ld.so.cache, how can i know that from which file ld.so.cache file has been generated? so that i can change it and can load my shared object libraries at the initialisation time...

Hmm... I'm not exactly sure what you're after here, but isn't the command you're looking for called 'ldconfig', not 'ldcache'?

iamnothere 02-26-2007 01:19 PM

There is no ldcache command, it is ldconfig, as alienDog stated. /etc/ld.so.conf is a text file, which lists directories in which shared libraries are to be located. This file is processed with /sbin/ldconfig to produce /etc/ld.so.cache. I.e. think of /etc/ld.so.conf as the 'source' file, which is 'compiled' with ldconfig to produce the output file /etc/ld.so.cache.

/etc/ld.so.cache is used by the dynamic linker (/lib/ld-linux.so.2) to locate libaries whenever a command is executed (since searching the filesystem everytime a command is run would be hideously slow). Note that ldconfig is not a daemon, it isn't running all the time, you just run it to process /etc/ls.so.conf (whenever libraries are installed/removed). If you don't have an /etc/ld.so.conf, then just create one.

Nishant Desai 02-26-2007 11:59 PM

Quote:

Originally Posted by iamnothere
There is no ldcache command, it is ldconfig, as alienDog stated. /etc/ld.so.conf is a text file, which lists directories in which shared libraries are to be located. This file is processed with /sbin/ldconfig to produce /etc/ld.so.cache. I.e. think of /etc/ld.so.conf as the 'source' file, which is 'compiled' with ldconfig to produce the output file /etc/ld.so.cache.

/etc/ld.so.cache is used by the dynamic linker (/lib/ld-linux.so.2) to locate libaries whenever a command is executed (since searching the filesystem everytime a command is run would be hideously slow). Note that ldconfig is not a daemon, it isn't running all the time, you just run it to process /etc/ls.so.conf (whenever libraries are installed/removed). If you don't have an /etc/ld.so.conf, then just create one.

Hiii,

I understand what you are saying, and i also have created the ld.so.conf, but how to make the command ldconfig under /sbin, so that whenever i run the command ldconfig it runs the /etc/ld.so.conf and produce the ld.so.cache? there is no ldconfig command in my /usr/sbin directory.

Hoping for the prompt reply.

Thanks for the help.
Nishant

jschiwal 02-27-2007 12:54 AM

Look for the ldconfig command in the /sbin/ directory. You should have it, because is is usually supplied along with glibc.

alienDog 02-27-2007 12:18 PM

Quote:

Originally Posted by jschiwal
Look for the ldconfig command in the /sbin/ directory. You should have it, because is is usually supplied along with glibc.

If not, then your installation is broken... ;)

Nishant Desai 02-27-2007 11:22 PM

Quote:

Originally Posted by alienDog
If not, then your installation is broken... ;)

Hiii,

Finally what i did is take the ld.so.conf, write the necessary code inside and then generate the ld.so.cache in my desktop linux and then copy it to my ARM Linux's Ramdisk, and it works for me, first i was in doubt that the file which has been created on the normal desktop wont work on the ARM processor, but after all it works for me.

Thanks,
Nishant

jschiwal 02-27-2007 11:35 PM

Maybe on embedded systems, one doesn't normally add libraries and ldconfig is considered to be superfluous.

FYI: I noticed that there is a new book "Embedded Linux by Example" in Barnes and Nobels.

Nishant Desai 02-28-2007 11:20 PM

Quote:

Originally Posted by jschiwal
Maybe on embedded systems, one doesn't normally add libraries and ldconfig is considered to be superfluous.

FYI: I noticed that there is a new book "Embedded Linux by Example" in Barnes and Nobels.

Hiii,
I dont think that ldconfig kind of files are superflous, because as in my case there are many cases can happened in which you want to load library files on the initialisation, and ldconfig is for that only.

Anyways, can you refer me to the site, where you found the above book.

Thanks,
Nishant


All times are GMT -5. The time now is 05:31 PM.