2

I am trying to compile some source code however when I enter the "make" command in the terminal it produces an error. From my limited understanding the problem seems to arise when the code attempts to produce .f90 files from the .F files. From reading on the web it seems that problem may be something to do with the c pre-processor. It looks like a c header is being added to the .f90 files which gfortran is then having an issue with. The output following the "make" command is as follows:

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-4.8 -P -C -traditional  -DGFORTRAN -P -C -traditional    -DWET_DRY -DMULTIPROCESSOR    -DLIMITED_NO  -DGCN                                        mod_prec.F > mod_prec.f90
/usr/bin/gfortran-4.8  -c   -I/home/dan/FVCOM3.2.2/FVCOM_source/libs/install/include        mod_prec.f90
Warning: Nonexistent include directory "/home/dan/FVCOM3.2.2/FVCOM_source/libs/install/include"
mod_prec.f90:1.1:

/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
 1
Error: Invalid character in name at (1)
mod_prec.f90:2.3:

   This file is part of the GNU C Library.
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:4.3:

   The GNU C Library is free software; you can redistribute it and/or
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:4.39:

   The GNU C Library is free software; you can redistribute it and/or
                                       1
Error: Unclassifiable statement at (1)
mod_prec.f90:5.3:

   modify it under the terms of the GNU Lesser General Public
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:6.3:

   License as published by the Free Software Foundation; either
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:6.57:

   License as published by the Free Software Foundation; either
                                                         1
Error: Unclassifiable statement at (1)
mod_prec.f90:7.3:

   version 2.1 of the License, or (at your option) any later version.
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:9.3:

   The GNU C Library is distributed in the hope that it will be useful,
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:10.3:

   but WITHOUT ANY WARRANTY; without even the implied warranty of
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:10.29:

   but WITHOUT ANY WARRANTY; without even the implied warranty of
                             1
Error: Unclassifiable statement at (1)
mod_prec.f90:11.3:

   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:12.3:

   Lesser General Public License for more details.
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:14.3:

   You should have received a copy of the GNU Lesser General Public
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:15.3:

   License along with the GNU C Library; if not, see
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:15.41:

   License along with the GNU C Library; if not, see
                                         1
Error: Unclassifiable statement at (1)
mod_prec.f90:16.4:

   <http://www.gnu.org/licenses/>.  */
    1
Error: Invalid character in name at (1)
mod_prec.f90:19.1:

/* This header is separate from features.h so that the compiler can
 1
Error: Invalid character in name at (1)
mod_prec.f90:20.3:

   include it implicitly at the start of every compilation.  It must
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:21.3:

   not itself include <features.h> or any other header that includes
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:22.4:

   <features.h> because the implicit include comes before any feature
    1
Error: Invalid character in name at (1)
mod_prec.f90:23.3:

   test macros that may be defined in a source file before it first
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:24.3:

   explicitly includes a system header.  GCC knows the name of this
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:25.3:

   header in order to preinclude it.  */
   1
Error: Unclassifiable statement at (1)
mod_prec.f90:27.1:

/* Define __STDC_IEC_559__ and other similar macros.  */
 1
Error: Invalid character in name at (1)
Fatal Error: Error count reached limit of 25.
make: *** [mod_prec.o] Error 1

I am new to linux and I have no real knowledge of C or FORTRAN so I apologies if the question is daft.

The output file (in this case mod_prec.f90) contains the following header which is the cause of the error due to the comment being in C format:

/* Copyright (C) 1991-2012 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */


/* This header is separate from features.h so that the compiler can
   include it implicitly at the start of every compilation.  It must
   not itself include <features.h> or any other header that includes
   <features.h> because the implicit include comes before any feature
   test macros that may be defined in a source file before it first
   explicitly includes a system header.  GCC knows the name of this
   header in order to preinclude it.  */

/* Define __STDC_IEC_559__ and other similar macros.  */
/* Copyright (C) 2005 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */



/* We do support the IEC 559 math functionality, real and complex.  */


/* wchar_t uses ISO/IEC 10646 (2nd ed., published 2011-03-15) /
   Unicode 6.0.  */

/* We do not support C11 <threads.h>.  */
6
  • What is your exact question?
    – Vincent
    Apr 22, 2015 at 14:02
  • I do not know why this header has been added to the .f90 files, the comments use C format and refers to GCC and a file features.h. I don't understand why it is being added to the .f90 file, it appears nowhere in the .F file. My question is then, how do I stop this header from being added to the .f90 files? I can post the header in full if it is helpful.
    – dan
    Apr 22, 2015 at 14:36
  • Give a minimal example, then it will be easier for people to help you. Apr 22, 2015 at 14:38
  • An edit has been made to the op to include the offending header.
    – dan
    Apr 22, 2015 at 17:24
  • This is a programming question, and really there's nothing UNIX or Linux specific about it.
    – JdeBP
    Apr 22, 2015 at 18:49

2 Answers 2

1

This is GCC bug #65387. And as you can see it is closed as not a bug. The C/C++ preprocessor is emitting C/C++ code into your post-processed Fortran program, because it's a C/C++ preprocessor.

If you're going to use the C/C++ preprocessor with Fortran programs per GCC's own Fortran doco, then do the part that the GCC Fortran doco doesn't tell you and use -fstandalone.

Further reading

1
  • Thanks for the links and the answer this has done the job.
    – dan
    Apr 23, 2015 at 11:10
0

The problem is with the .F source files. You're attempting to use C/C++ style comments, and the Fortran compiler isn't seeing them as comments. It seems them as bad syntax.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .