View Full Version : Linking Compiler in Terminal
Jun 11, 2008, 11:12 AM
I downloaded g95, a fortran compiler as binary. I tried to link it via "ln -s PATH_TO_BINARY/BINARY /usr/bin/g95" but it doesn't work. "Command not found" and "which" g95 tells me there is no g95 in /usr/bin/ (or anywhere else). So i looked up in /usr/bin and actually there is a "g95" !?
I linked it again, but this time without "-s" (although the compiler manual tells me to link it with "-s") and now the linking works but the compiler doesnt !?
the binary itself without link works fine.
Jun 11, 2008, 11:54 AM
Is g95 executable? Which will tell you what would be executed if you ran that command, but if it is not executable, even if it's in your path, it won't run. Make sure f951 is also in your path and executable.
Also, were these binaries you downloaded statically linked against the gcc libraries? What about the g95 runtime library libf95.a? Do you have a copy of that that was precompiled?
I've always had to build from source because we had to apply some patches to the runtime to fix a few things we've found, so I haven't dealt with a binary installation before.
Jun 11, 2008, 12:04 PM
"Is g95 executable ?" - yes it is.
I already compiled and built files using 95 by executing it directly. Thats why I don't think its a library issue. It works fine but its pretty inconvenient to go that long way and everytime type the directory the binary is located to compile sourcecode. (eg. /Applications/G95/G95_binary -o file file.f90 when it could be g95 -o file file.f90 as a regular command.)
Jun 11, 2008, 12:09 PM
I can't say why the symlink didn't work, but you should be able to add /Applications/G95/ to your path to save you some typing if ln isn't doing what you'd hope. You can just add:
to your .bash_profile.
Otherwise... I'm not at my Mac at the moment, but I've never seen issues symlinking before.
sudo ln -s /Applications/G95/G95_binary /usr/bin/g95
to see if the issue is creating a file in a root owned directory without privileges. If it's not that, I am at a loss.
Jun 11, 2008, 12:12 PM
well, a cheap shot workaround would be to insert the following line in your ~/.bash_profile or ~/.bashrc file (assuming you're using bash....adjust accordingly for tcsh, etc)
Jun 11, 2008, 02:04 PM
It might be worth checking that your soft link is actually pointing to what you think it should be. You could for example do:-
ls -lL /usr/bin/g95
Whenever I make soft links I usually use tab completion on the command line to make sure I've got the path right. I don't know if you've used it before but you just need to type the first few letters of a path and hit tab and the command line will either complete that part of the path or beep. If it beeps just type a few more letters and try again, or hit tab twice to see a list of possibilities.
As an alternative, you could just move G95_binary into /usr/bin.
b e n