Home Ask Login Register

Developers Planet

Your answer is one click away!

Mark S February 2016

Installing gfortran in Linux as a user

I am a non-administrator user of a Linux (CentOS 6.6) server at work. I log in through a terminal program on a windows computer. My problem is that the IT does not feel comfortable upgrading GCC/gfortran for me so I want to just run it from my personal folders. They claim the latest yum (devtoolset-3 for this OS version) will downgrade some other feature they have. It's not the latest version of GCC anyway.

I have downloaded the latest GCC 5.3 binaries and prerequisites from gfortran.com and can almost get my test code to compile. Actually, when I do the following it will compile with -c but will not not link. That folder is where I put the prerequisites and also I copied stuff from the /usr/lib64 directory into there as well.

./gfortran test.f90 

The error message is as follows: collect2: fatal error: cannot find 'ld'

But ld does exist

-bash-4.1$ whereis ld
ld: /usr/bin/ld /usr/share/man/man1/ld.1.gz


Mark S February 2016

After much effort I have answered my own question! To install GCC to my own personal Linux account as a non-administrator, I ended up having to compile GCC and not use the binaries I originally downloaded. My friend was make install which knows where everything needs to go, which I did not have with the binaries.

The key was to install to my user root directory /GCC with the following command provided with the build-it-yourself method (-prefix):

../gcc-5.3.0/configure --prefix$HOME/gcc-5.3.0 --enable-languages=c,c++,fortran --disable-multilib

For me I had to disable multilib because I guess my system only has 64 bit libraries (I think this was causing my original problem).

Before I got to that point, I had to also download the prerequisites manually since my workplace I suppose blocks the automatic prerequisite downloader as referenced in these instructions.


Prerequisites need to be taken from here, placed into the root of the directory that gets created when you unzip GCC. Then unzip them and link them as is done in the batch file you have already unzipped ./contrib/download_prerequisites.


Finally I need to run the following command, after it is all up so it looks at the new libraries. I will add this to my .profile when I am ready to fully switch to the local newer version.


For now I am running gfortran with the following command but also I will add this to my .profile later.

/users/home/myself/gcc-5.3.0/bin/gfortran Test.f90

It works! Latest version of GCC running from my local Linux user non-administrator account!

Edited to add how we resolved this for the network group: IT did not want to overwrite the original

Post Status

Asked in February 2016
Viewed 2,071 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life