【发布时间】:2021-11-29 00:16:33
【问题描述】:
在我的工作中,我使用了一个名为 SPheno 的基于 Fortran 的程序。安装了 SPheno-4.0.4 后,我尝试安装新版本的 SPheno-4.0.5,但是,当在 Makefile 中选择 F90 = gfortran 时,就像我在工作的 SPheno-4.0.4 版本上所做的那样,它返回给我以下错误:
cd src ; /Library/Developer/CommandLineTools/usr/bin/make F90=gfortran version=400.00
gfortran -c -O -J../include -I../include -DGENERATIONMIXING -DONLYDOUBLE Control.F90
ar ../lib/libSPheno.a Control.o
/Library/Developer/CommandLineTools/usr/bin/ar: illegal option -- .
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make[1]: *** [../lib/libSPheno.a(Control.o)] Error 1
make: *** [bin/SPheno] Error 2
这个错误甚至意味着什么,我需要改变什么?我什至尝试从 SPheno-4.0.4 复制/粘贴 Makefile,只是为了检查。
如果有问题,当运行命令 gfortran -v 时,它会返回我:
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/11.2.0/libexec/gcc/x86_64-apple-darwin19/11.2.0/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: ../configure --prefix=/usr/local/Cellar/gcc/11.2.0 --libdir=/usr/local/Cellar/gcc/11.2.0/lib/gcc/11 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran,d --program-suffix=-11 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-zstd=/usr/local/opt/zstd --with-pkgversion='Homebrew GCC 11.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --enable-libphobos --build=x86_64-apple-darwin19 --with-system-zlib --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.2.0)
使用的 Makefile 如下:
# please put here your preferred F95/F2003 compiler
# the options in src/Makefile have been put for the
# cases NAG's nagfor, gfortran, g95, Lahey's lf95 and Intels ifort
# Please uncomment the corresponding line
# F90 = nagfor
F90 = gfortran
# F90 = g95
# F90 = lf95
# F90 = ifort
Model = src
version = 400.00
bin/SPheno:
cd ${Model} ; ${MAKE} F90=${F90} version=${version}
clean:
rm -f *.o *~ */*.o */*~
cleanall:
rm -f bin/SPheno lib/*.a *.o *~ */*.o */*~ include/*
.PHONY: bin/SPheno clean cleanall
【问题讨论】:
-
从您上面给出的内容看来,问题与 gfortran 无关,而是与 ar 相关,您需要提供一个额外的选项来指定您想要做什么 - 我猜是您需要-r。我不能说你是怎么做到的,你没有提供足够的信息。
-
非常感谢您的回复!我可以提供什么信息来使问题更清楚?我不太了解返回的错误,所以我不知道确切地显示什么。我也尝试使用命令
make -r,但它不起作用。
标签: macos makefile fortran gnu-make gfortran