Friday, July 29, 2011

ldd shows "CANNOT FIND" for wrong archive lib or share - a script solution

1. Let us assume that you already logged in as you work user.

[sgupta@rhel60x86 ~]$

2. Now create a file name ".envpath". I am making it hidden so that nobody else will see it except me.

[sgupta@rhel60x86 ~]$ touch .envPath

3. Open the file in the vi editor and enter the following to that file 


export PATH

export LIBPATH

Note :
1. I am exporting the existing LD_LIBRARY_PATH also that is why I have used $LD_LIBRARY_PATH also.
my-library-path contains path of the libraries that is of your application or those libraries that you want your compiler will choose first. You can place it before $LD_LIBRARY_PATH also to use it first.
2. Same in case of PATH variable, myCommands contains your application specific executable. You can rearrange it also.
3. Same is case of LIBPATH also, my-libpath contains the library path to your application library.
4. You need to change the whole path as I have mentioned like "/usr/lib64:/lib64:/usr/local/lib64:" these are red hat linux 64 bit based path. For different OS's you neeed to add your library path.
* Most of the time you don't need to set this variable, e.g. in Red Hat based systems like RHEL Fedora, SUSE etc. But In case of AIX you need to set this as well.

4. Now to execute this script run it like that
[sgupta@rhel60x86 ~]$ . ./.envPath

Here general syntax is as follow
[sgupta@rhel60x86 ~]$ <.> <file location> <file-name>

For example: 

[sgupta@rhel60x86 ~]$ . /home/sgupta/.env-path

No comments:

Post a Comment