'configure: error: cannot compile a simple Fortran program' with Fortran compiler installed

Viewed 5567

I'm trying to install gadgetviewer on my macbook, however when I run

./configure prefix=/usr/local/bin

after a load of output I get:

checking for g_key_file_new in -lglib-2.0... no
checking how to get verbose linking output from gfortran... configure: 
WARNING: compilation failed

checking for Fortran libraries of gfortran...
checking for dummy main to link with Fortran libraries... none
checking for Fortran name-mangling scheme... configure: error: in `/Users/chris/Downloads/gadgetviewer-1.0.7':
configure: error: cannot compile a simple Fortran program 

But I have gfortran installed and working:

$ which gfortran
/usr/local/bin/gfortran

Does anyone have any ideas why it can't seem to find the fortran compiler?

Thanks as always.

edi1:

my path output is:

$ echo $PATH

/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/opt/ldg/bin:/opt/ldg/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/chris/.local/bin:/Applications/root_v6.06.06/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/TeX/texbin

(won't let me put that in a code block)

In the README we have:

1.2 Specifying compilers and flags
----------------------------------

The compilers to use can be specified by setting the following
environment variables before running the configure script:

CC      - C compiler
CFLAGS  - C compiler flags
FC      - Fortran 90 compiler
FCFLAGS - Fortran compiler flags

and my config.log file has in it:

CC='gcc'
CFLAGS='-g -O2'
...
CPP='gcc -E'
CPPFLAGS=''
...
FC='gfortran'
FCFLAGS=''
FCFLAGS_f90=''

where I have ommitted some of the information I don't think is relevant. So the C compiler has flags and the fortran one does not, perhaps this is relevant? I'm totally clueless as to what's going on here (pretty new to installing stuff like this).

edit2:

Also just found this is on the config.log:

configure:19184: checking how to get verbose linking output from gfortran
configure:19200: gfortran -c   conftest.f >&5
./configure: line 19202: /usr/local/bin/gfortran: Bad CPU type in executable
configure:19207: $? = 126
configure: failed program was:
|       program main
|
|       end
configure:19291: WARNING: compilation failed
configure:19298: result:
configure:19300: checking for Fortran libraries of gfortran
configure:19323: gfortran -o conftest conftest.f -lz -lm
./configure: line 19327: /usr/local/bin/gfortran: Bad CPU type in executable
configure:19500: result:
configure:19515: checking for dummy main to link with Fortran libraries
configure:19559: gcc -o conftest -g -O2   conftest.c -lz -lm   >&5
configure:19566: $? = 0
configure:19654: result: none
configure:19692: checking for Fortran name-mangling scheme
configure:19711: gfortran -c   conftest.f >&5
./configure: line 19713: /usr/local/bin/gfortran: Bad CPU type in executable
configure:19718: $? = 126
configure: failed program was:
|       subroutine foobar()
|       return
|       end
|       subroutine foo_bar()
|       return
|       end
configure:19920: error: in `/Users/chris/Downloads/gadgetviewer-1.0.7':
configure:19923: error: cannot compile a simple Fortran program
0 Answers
Related