Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28592 Discussions

ifort error to find as and ld after installation gcc

Yingli_N_
Beginner
1,425 Views

Dear all,

I install gcc to my compiler directory:

~/compilers/gcc/gcc-5.3.0/bin/gcc

and I setup enviroment variables:

#-------------------------------------------------------------------------------

# GCC
#
export GCCVERSION=5.3.0
export GCCROOT=$HOME/compilers/gcc/gcc-$GCCVERSION
export LD_LIBRARY_PATH=$GCCROOT/lib64:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$GCCROOT/include/c++/$GCCVERSION:$C_INCLUDE_PATH
export C_INCLUDE_PATH=$HOME/compilers/gcc/source/gcc-5.3.0/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu:$C_INCLUDE_PATH
export INCLUDE=$HOME/compilers/gcc/source/gcc-5.3.0/x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu:$INCLUDE
export PATH=$GCCROOT/bin:$PATH
#-------------------------------------------------------------------------------

export MPI_HOME=$HOME/program/mpich/mpich2-1.5-gfortran-$GCCVERSION

export PATH=$MPI_HOME/bin:$PATH
export INCLUDE=$MPI_HOME/include:$INCLUDE

But when I compile with ifort, it reported the following errors:

make[2]: Leaving directory `/home/user/program/zindo/zblas'
ifort -o zindo -traceback  -L./ control/zindo.o control/block1.o control/version.o control/libversion.o -Llib -lcontrol -lgeometry -lscf -lci -lspinorbit -lproperties -lclasic -lmndo -lgvb -llinear -llocalization -lsolvent -lmoments -linterfaces -lintegrals -lutil -lio -lalgebra -lzblas 
/home/user/compilers/gcc/gcc-5.3.0/bin/as: No such file or directory
/home/user/compilers/gcc/gcc-5.3.0/bin/ld: No such file or directory

However when I use "which" to locate the commad "as" and "ld", it can be found in the /usr/bin directory:

/usr/bin/as

/usr/bin/ld

 

 

Can anybody help me to solve this problem?

 

0 Kudos
1 Solution
TimP
Honored Contributor III
1,425 Views

Gcc and Fortran can't work without the binutils installation.  Normally, installing a g++ development system package would provide those, but likely in its own path under /usr/

View solution in original post

0 Kudos
3 Replies
TimP
Honored Contributor III
1,426 Views

Gcc and Fortran can't work without the binutils installation.  Normally, installing a g++ development system package would provide those, but likely in its own path under /usr/

0 Kudos
Yingli_N_
Beginner
1,425 Views

Dear Tim,

Thanks very much for your kindly reply. This problem puzzled me for several days. I have binutils in my system and I can find "as" and "ld" command in "/usr/bin" directory using "which" command. But I don't know why ifort search "as" and "ld" command in /home/user/compilers/gcc/gcc-5.3.0/bin/ directory, not "/usr/bin", which is different form "which" command!

Another point is that you mention the g++ compiler. I don't understand that I have install g++ compiler in gcc package, and I can find g++ in /home/user/compilers/gcc/gcc-5.3.0/bin/g++ . Do you mean that I should install another "g++ package", but not gcc?

Tim P. wrote:

Gcc and Fortran can't work without the binutils installation.  Normally, installing a g++ development system package would provide those, but likely in its own path under /usr/

0 Kudos
mecej4
Honored Contributor III
1,425 Views

I'm speculating here, but I find the following reasonable as an explanation of what was reported:

[Speculation 1] The Intel Fortran installation in Linux uses the environmental variable GCCROOT as the starting location relative to which necessary binutils such as ld and as are accessed. [Speculation 2] You, however, probably have two versions of GCC -- the one (version 4.x?) that came with the OS and, along with binutils, is in a standard location for your Linux, and a later one (version 5.3) that you installed in a non-standard location under /home/user. [Speculation 3] The later version of GCC contains only the GCC driver, front end and back end, and the GCC driver looks in /usr/bin for ld, as, etc., ignoring GCCROOT.

[Speculation 4] IFort, however, expects GCCROOT to point to the standard location, so ends up not finding ld, as, etc.

To test these speculations, you can repeat one of your compilations with the -watch compiler option added. That option causes details of the arguments passed to the various tools to be revealed. I suspect that you will see /home/user/compilers/gcc/gcc-5.3.0/bin/as and /home/user/compilers/gcc/gcc-5.3.0/bin/ld among other commands.

If that is confirmed, as a work-around you may need to reset GCCROOT to the standard GCC location, at least when you are in an Ifort command shell environment. I defer to the Intel personnel to advise you about a more permanent solution for the GCCROOT issue.

------

Let's not forget these words of caution:

For every complex problem there is an answer that is clear, simple, and wrong. -- H. L. Mencken

 

0 Kudos
Reply