FVCOM在FVCOM_source文件夹内make失败
报错信息如下:
make: Circular mod_prec.o <- mod_prec.o dependency dropped.
make: Circular mod_prec.o <- mod_prec.o dependency dropped.
make: Circular mod_prec.o <- mod_prec.o dependency dropped.
/usr/bin/cpp -P -C -traditional -DIFORT -P -C -traditional -DWET_DRY -DMULTIPROCESSOR -DLIMITED_NO -DGCN -DRIVER_FLOAT -DOLD_PETSC mod_prec.F > mod_prec.f90
mpif90 -c -O3 -I/home/yzh/work/FVCOM3.2.1/FVCOM_source/libs/install/include mod_prec.f90
mod_prec.f90(1): error #5082: Syntax error, found '/' when expecting one of: <LABEL> <END-OF-STATEMENT> ; BLOCK BLOCKDATA PROGRAM MODULE TYPE INTEGER REAL ...
/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
^
mod_prec.f90(16): error #5145: Invalid blank/tab
<http://www.gnu.org/licenses/>. */
----------------------------------^
mod_prec.f90(20): error #5145: Invalid blank/tab
include it implicitly at the start of every compilation. It must
-----------------------------------------------------------^
mod_prec.f90(27): error #5120: Unterminated character constant
/* glibc's intent is to support the IEC 559 math functionality, real
--------^
mod_prec.f90(27): error #5144: Invalid character_kind_parameter. No underscore
/* glibc's intent is to support the IEC 559 math functionality, real
--------------------------------------------------------------------^
mod_prec.f90(28): error #5145: Invalid blank/tab
and complex. If the GCC (4.9 and later) predefined macros
---------------^
mod_prec.f90(30): error #5277: Syntax error, found ',' following statement keyword
whether the overall intent is to support these features; otherwise,
----------------------------------------------------------------------^
mod_prec.f90(32): error #5145: Invalid blank/tab
define these macros by default. */
----------------------------------^
mod_prec.f90(36): error #5145: Invalid blank/tab
/* wchar_t uses Unicode 8.0.0. Version 8.0 of the Unicode Standard is
------------------------------^
mod_prec.f90(38): error #5276: Unbalanced parentheses
2015-05-15). */
-------------^
mod_prec.f90(38): error #5145: Invalid blank/tab
2015-05-15). */
---------------^
mod_prec.f90(40): error #5145: Invalid blank/tab
/* We do not support C11 <threads.h>. */
-------------------------------------^
mod_prec.f90(1): catastrophic error: Could not recover from previous syntax error
compilation aborted for mod_prec.f90 (code 1)
makefile:42: recipe for target 'mod_prec.o' failed
make: *** [mod_prec.o] Error 1
检查后发现是因为mod_prec.f90文件开头有一段来自GNU C Library的注释。
解决方案
以 Invalid blank/tab 为关键词检索,发现在make.inc文件中DEF_FLAGS一行的末尾,添加 -nostdinc -E 参数。
进入libs文件重新编译
make CC=icc CXX=icpc FC=ifort
cd .. #回到FVCOM_source文件夹
make
即可。