Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos ';配置:错误:无法编译简单的Fortran程序';安装Fortran编译器后_Macos_Fortran_Gfortran - Fatal编程技术网

Macos ';配置:错误:无法编译简单的Fortran程序';安装Fortran编译器后

Macos ';配置:错误:无法编译简单的Fortran程序';安装Fortran编译器后,macos,fortran,gfortran,Macos,Fortran,Gfortran,我正在尝试在我的macbook上安装,但是当我运行 ./configure prefix=/usr/local/bin 在加载输出后,我得到: 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 librari

我正在尝试在我的macbook上安装,但是当我运行

./configure prefix=/usr/local/bin
在加载输出后,我得到:

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 
但我已经安装了gfortran并开始工作:

$ which gfortran
/usr/local/bin/gfortran
有人知道为什么找不到fortran编译器吗

一如既往地谢谢你

edi1:

我的路径输出是:

$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python:/opt/ldg/sbin:/Library/Frameworks/Versions/2.7/bin:/Users/chris/.local/bin:/Applications/root\u v6.06.06/bin:/usr/bin:/usr/bin:/usr/bin:/usr/sbin:/usr/local/bin:/sbin:/L图书馆/特克斯/特克斯宾

(不让我把它放在代码块中)

在这方面,我们有:

我的config.log文件中包含:

CC='gcc'
CFLAGS='-g -O2'
...
CPP='gcc -E'
CPPFLAGS=''
...
FC='gfortran'
FCFLAGS=''
FCFLAGS_f90=''
我在那里写了一些我认为不相关的信息。所以C编译器有标志,而fortran编译器没有,也许这是相关的?我完全不知道这里发生了什么(对于安装这样的东西来说是非常新的)

编辑2:

另外,刚刚在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

请检查config.log以了解到底发生了什么。路径中是否有/usr/local/bin?
--前缀
选项用于指定软件的安装位置。我建议在发出
/configure
命令之前,在终端中显式键入导出:
export CC=gcc
export FC=gfortran
可执行文件中的CPU类型不正确
您有没有可能错误下载了PowerPC版本的gfortran?尝试只运行
gfortran-v
。我使用homerew安装了gfortran-我在运行
gfortran-v
时遇到同样的错误-我应该如何正确安装gfortran?
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