Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-02-2014, 12:55 PM   #1
Registered: Nov 2007
Location: CT
Posts: 248

Rep: Reputation: 26
LD_LIBRARY_PATH not set within tcsh script

everything works fine if I run my program manually.
i have a script written, first line of script is #!/bin/tcsh, and that launches a program written in fortran and compiled with the intel compiler.

my user account is set to tcsh. i source compilervars.csh after logging in and that sets my PATH and LD_LIBRARY_PATH environment variables.
so if i run my program manually, it runs.

but within my tcsh script when that calls my program i get
"error while loading shared libraries: cannot open shared object file: No such file or directory"

so i put an echo $LD_LIBRARY_PATH into my script and that shows that environment variable is not set, it's back to what it was prior to when i sourced the intel/compilervars.csh script.

how do I make it so that LD_LIBRARY_PATH contains the correct stuff?
I'm guessing when you launch a script like this it's like a new login process so it only knows what's in /etc/cshrc and /etc/cshrc.local rather than using everything from your current environment?
this is on SLES 11.3 x86_64.

i'm asking because i don't want to edit /etc/csh.cshrc.local at the moment which would affect all users, and I have problems with other software on the system referencing the intel compiler and mkl and stuff, so i was hoping to keep the intel compiler a manual setup.

Last edited by ron7000; 09-02-2014 at 12:57 PM.
Old 09-02-2014, 02:26 PM   #2
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,133

Rep: Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262Reputation: 1262
You can use /bin/env to set environment variables when running your program. If you were using bash you could export your local variable to the environment, but I have no idea if there is an equivalent to export in tcsh.
Old 09-02-2014, 03:09 PM   #3
Registered: Nov 2007
Location: CT
Posts: 248

Original Poster
Rep: Reputation: 26
i ended up doing "source /opt/intel/bin/compilervars.csh intel64" within my script and that solved my problem.

i'm guessing when launching a new script it doesn't use your existing environment variable setup... maybe a security thing.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set LD_LIBRARY_PATH galapogos Linux - Software 3 11-21-2008 09:25 AM
Unale to permanently set LD_LIBRARY_PATH cheeta05r Fedora 7 08-30-2007 08:16 PM
Cannot set LD_LIBRARY_PATH in .cshrc (able to set other env variables) senthilpr_in Linux - Newbie 4 02-26-2007 12:46 PM
set LD_LIBRARY_PATH to what? itz2000 Linux - Newbie 3 11-15-2006 08:34 PM
how to set LD_LIBRARY_PATH environment variable snakeo2 Linux - Newbie 3 05-25-2005 07:08 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration