configure: WARNING: cannot run mixed C/Fortran code


#1

Description:
Compilation of GNU-R
Operating System:
Ubuntu 12.04.1 LTS
Error:

checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, extra underscore
checking whether f77 appends underscores to external names... yes
checking whether f77 appends extra underscores to external names... yes
checking whether mixed C/Fortran code can be run... configure: WARNING: cannot run mixed C/Fortran code
configure: error: Maybe check LDFLAGS for paths to Fortran libraries?

config.log

checking whether mixed C/Fortran code can be run
   cftest:
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libf2c.so: undefined reference to `MAIN__'
collect2: ld returned 1 exit status
configure:23907: WARNING: cannot run mixed C/Fortran code
configure:23909: error: Maybe check LDFLAGS for paths to Fortran libraries?

Solution:
first check whether you have libf2c.so available:

ls -l /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/libf2c.so

which is actually

ls -l /usr/lib/libf2c.so

If yes, this may be ubuntu linux specific error. To resolve this issue:

$ sudo mv /usr/lib/libf2c.so /usr/lib/libf2c.so_backup
$ sudo ln -s /usr/lib/libf2c.a /usr/lib/libf2c.so

#2

#3