Find the answer to your Linux question:
Results 1 to 5 of 5
Dear Linux Community: I am using Red Hat Enterprise Linux 4 and having difficulty setting the environment variable LD_LIBRARY_PATH. I tried some different ways: 1) In my .bash_profile, I added: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Location
    St. Louis, MO
    Posts
    4

    Exclamation Help! Setting LD_LIBRARY_PATH


    Dear Linux Community:

    I am using Red Hat Enterprise Linux 4 and having difficulty setting the environment variable LD_LIBRARY_PATH. I tried some different ways:

    1) In my .bash_profile, I added:

    LD_LIBRARY_PATH=/usr/local/comsol33/lib/glnxa64/gfortran64/lib:/usr/lib/gcc/x86_64-redhat-linux/3.4.3
    export LD_LIBRARY_PATH

    (printenv and echo did not show a value for the variable, and the program did not find the path)

    2) I created a script called set_LD_LIBRARY_PATH in my /home/tkane/bin directory which contains the following code.

    LD_LIBRARY_PATH=/usr/local/comsol33/lib/glnxa64/gfortran64/lib:/usr/lib/gcc/x86_64-redhat-linux/3.4.3
    export LD_LIBRARY_PATH
    echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH
    (I ran the script and the path was echoed as output only -- not set)

    Issuing the echo $LD_LIBRARY_PATH at the command prompt results in a blank for both methods, and the program I am running does not find the required files.

    The only way I have found to set LD_LIBRARY_PATH and have it 'echoable' and useful to the program is to set it at the command line and then invoke the program from the same window.

    Is there some more automated way to set this variable? Is there a problem with the way I am attempting to export.

    Any input would be greatly appreciated.

    Tom

  2. #2
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    When you set a variable, you are only setting it in the current shell or sub-shell. When you export it, you are making the variable available to the current shell and all subsequent shells. This is why after the execution of your script, the variable was no longer set.

    Open your /etc/profile. Declare LD_LIBRARY_PATH and add it to the line where all the variables are exported also.

  3. #3
    Just Joined!
    Join Date
    Jan 2007
    Location
    St. Louis, MO
    Posts
    4

    Exclamation Still Need Help: LD_LIBRARY_PATH

    Dear Likwid,

    I added the following lines to my /etc/profile

    #ADDED BY TJK
    LD_LIBRARY_PATH=/usr/local/comsol33/lib/glnxa64/pgi64/lib:/usr/lib/gcc/x86_64-redhat-linux/3.4.3
    export LD_LIBRARY_PATH
    TOM='irish'
    LIZA=redbird
    export TOM LIZA
    ######

    when I did a printenv or echo, everything showed up except the LD_LIBRARY_PATH.

    It isn't a problem of quotes, because I exported other variables with and without them.

    Any other suggestion,

    Tom
    ps-The results of the printenv command are shown belo

    % printenv
    SSH_AGENT_PID=27155
    HOSTNAME=localhost.localdomain
    COMSOL_BLAS_DEBUG=on
    TOM=irish
    SHELL=/bin/bash
    TERM=xterm
    HISTSIZE=1000
    GTK_RC_FILES=/etc/gtk/gtkrc:/home/tkane/.gtkrc-1.2-gnome2
    WINDOWID=41945426
    QTDIR=/usr/lib64/qt-3.3
    USER=tkane
    LS_COLORS=no=00:fi=00:di=00;34:ln=00;36i=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05; 37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00 ;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32 :*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:* .taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=0 0;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31: *.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:* .bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.t if=00;35:
    GNOME_KEYRING_SOCKET=/tmp/keyring-54ByKt/socket
    SSH_AUTH_SOCK=/tmp/ssh-niyth27098/agent.27098
    KDEDIR=/usr
    SESSION_MANAGER=local/localhost.localdomain:/tmp/.ICE-unix/27098
    MAIL=/var/spool/mail/tkane
    DESKTOP_SESSION=default
    PATH=/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/tkane:/home/tkane/bin:/usr/lib:/usr/local/comsol33/bin:/usr/local/comsol33/lib/glnxa64/pgi64/lib:/usr/lib/gcc/x86_64-redhat-linux/3.4.3
    INPUTRC=/etc/inputrc
    PWD=/home/tkane
    LANG=en_US.UTF-8
    PS1=%
    GDMSESSION=default
    SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
    HOME=/home/tkane
    SHLVL=2
    GNOME_DESKTOP_SESSION_ID=Default
    LOGNAME=tkane
    DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-xYWTQLy6Mg
    LIZA=redbird
    LESSOPEN=|/usr/bin/lesspipe.sh %s
    DISPLAY=:0.0
    G_BROKEN_FILENAMES=1
    COLORTERM=gnome-terminal
    XAUTHORITY=/home/tkane/.Xauthority
    _=/usr/bin/printenv

  4. #4
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Try adding the path to /etc/ld.so.conf

  5. #5
    Just Joined!
    Join Date
    Jan 2007
    Location
    St. Louis, MO
    Posts
    4

    Setting LD_LIBRARY_PATH

    My /etc/ld.so.conf consisted of:

    include ld.so.conf.d/*.conf
    /usr/ofed/lib64

    and I added these two lines:

    /usr/local/comsol33/lib/glnxa64/gfortran64/lib
    /usr/lib/gcc/x86_64-redhat-linux/3.4.3

    all to no avail (the program does find the path, and it LD_LIBRARY_PATH does not show up with echo)

    Any other ideas?

    Best Regards,

    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •