Results 1 to 9 of 9
Hello everyone,
Thank you for taking the time to read this. I am pretty new at Linux so I apologize for the stupid question.
Recently, I just installed the g95 ...
- 09-26-2010 #1Just Joined!
- Join Date
- Aug 2010
- Posts
- 11
Symbolic Link
Hello everyone,
Thank you for taking the time to read this. I am pretty new at Linux so I apologize for the stupid question.
Recently, I just installed the g95 FORTRAN compiler and want to create a link to it so I can use it anywhere (ie: in the same way typing "firefox" will open a window no matter what directory you type it in). For example, I just want to able to call the compiler from the directory that includes the source code files like so:
~/research/fortran_code> g95 hello_world.f90
I tried a few different combinations using "ln -s" but the link would never work. I can run the code by moving into the install/bin file of the compiler, but it's really inconvenient. Anyone have any suggestions?
- 09-26-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
Where (what directory and name) was it installed to?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-26-2010 #3Just Joined!
- Join Date
- Aug 2010
- Posts
- 11
The compiler is installed in this directory:
g95-install/bin/i686-pc-linux-gnu-g95
- 09-26-2010 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
This is only a relative directory/path. Where, exactly, is it installed? In your home directory?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-26-2010 #5Just Joined!
- Join Date
- Aug 2010
- Posts
- 11
Yes, sorry, its:
/home/peter/g95-install/bin/i686-pc-linux-gnu-g95
- 09-26-2010 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
Assuming it also put a lib directory there, you would need to do the following:
1. Create a link to the executable in either /bin or /usr/local/bin: sudo ln -s /home/peter/g95-install/bin/i686-pc-linux-gnu-g95 /usr/bin/g95
and: export LD_LIBRARY_PATH=/home/peter/g95-install/lib:${LD_LIBRARY_PATH}
The second command is to make the shared libraries available to the compiler and built executables.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-27-2010 #7
So I think you're a bit confused on what you're trying to do.
In order to run a program without giving the whole path to it, you need to put the directory of that program into your PATH. You can see your current path by running:
from the commandline.Code:echo $PATH
So now, I think you have two options.
1) Add ~/g95-install/bin/ to your path:
2) Create a dedicated local bin directory, add it to your path, and add a symlink to your program from that:Code:PATH=~/g95-install/bin:$PATH
In both of these cases, you will probably want to add the PATH variable modification to your bashrc.Code:mkdir ~/bin PATH=~/bin:$PATH ln -s ~/g95-install/bin/i686-pc-linux-gnu-g95 ~/bin/g95
Does this make sense?DISTRO=Arch
Registered Linux User #388732
- 09-27-2010 #8Just Joined!
- Join Date
- Aug 2010
- Posts
- 11
- 09-27-2010 #9Just Joined!
- Join Date
- Aug 2010
- Posts
- 11


Reply With Quote
