mdolab / idwarp

IDWarp is a mesh warping package for the MACH framework.
Other
17 stars 29 forks source link

Can't compile with '-std=f2008' #70

Closed DavidAnderegg closed 2 years ago

DavidAnderegg commented 2 years ago

Description

I am trying to update my local install. But i can't compile when i use the default compiler flag '-std=f2008'. If i remove it, it works.

Steps to reproduce issue

  1. Try compiling it with the default 'config.LINUX_GFORTRAN_OPENMPI.mk'

Current behavior

I get this error:

...
make[3]: Entering directory '/home/andv/Downloads/MACH/idwarp/src/modules'
../..//Rules.mk:20: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:20: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:14: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:14: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:14: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:14: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:8: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:8: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:2: warning: ignoring prerequisites on suffix rule definition
../..//Rules.mk:2: warning: ignoring prerequisites on suffix rule definition
mpifort -I../..//mod -I/home/andv/.mamba/envs/MACH/external/cgns/include -I/home/andv/.mamba/envs/MACH/external/hdf5/include -fPIC -fdefault-real-8 -O2 -std=f2008 -I/home/andv/.mamba/envs/MACH/external/petsc/include -I/home/andv/.mamba/envs/MACH/external/petsc/ -c gridData.F90 -o ../..//obj/gridData.o
gridData.F90:11:6:

   11 |   use petsc
      |      1
Error: GNU Extension: Variable ‘petsc_comm_world’ at (1) is in COMMON but only in BLOCK DATA initialization is allowed
gridData.F90:11:6:

   11 |   use petsc
      |      1
Error: GNU Extension: Variable ‘petsc_comm_self’ at (1) is in COMMON but only in BLOCK DATA initialization is allowed
make[3]: *** [../..//Rules.mk:2: gridData.o] Error 1
make[3]: Leaving directory '/home/andv/Downloads/MACH/idwarp/src/modules'
make[2]: *** [Makefile:49: all] Error 2
make[2]: Leaving directory '/home/andv/Downloads/MACH/idwarp/src/modules'
make[1]: *** [Makefile:55: warp] Error 1
make[1]: Leaving directory '/home/andv/Downloads/MACH/idwarp'
make: *** [Makefile:24: default] Error 2

Expected behavior

It should compile with default flags.

Code versions

eirikurj commented 2 years ago

What version of idwarp are you trying to build, and what is the compiler version (gcc and gfortran)? I also notice that there are suffix rule warnings showing up, but they should be gone with the latest commit.

DavidAnderegg commented 2 years ago

Hi

idwarp: 2.6.0 gcc: 9.4.0 gfortran: 9.4.0

I also tested with gcc/gfortran 11.2.0. And i also tried with the last commit. Same result

eirikurj commented 2 years ago

The compiler version 9.4.0 should be good, in fact we use this version in some of our nightly builds and tests. From your build log, other source files seem to compile properly with the flag, but files that import PETSc fail. We also test this particular PETSc version, without issues. How is PETSc compiled and installed locally?

DavidAnderegg commented 2 years ago

I used these commands (after cloning and checking out v3.15):

./configure \
    --prefix=$CONDA_PREFIX/external/petsc/ \
    --PETSC_ARCH="real-debug" \
    --with-scalar-type=real \
    --with-debugging=1 \
    --download-metis=yes \
    --download-parmetis=yes \
    --download-superlu_dist=yes \
    --with-shared-libraries=yes \
    --with-fortran-bindings=1 \
    --with-cxx-dialect=C++11

# run the build command shown in the last line
# run the install command shown in the last line
# run the test command shown in the last line

export PETSC_DIR=$CONDA_PREFIX/external/petsc/
export PETSC_ARCH=""

pip install petsc4py==3.15 --no-cache-dir
ewu63 commented 2 years ago

This is odd, I can't reproduce this on the current HEAD, using gcc/gfortran 11.2.0 and the config file you linked.

DavidAnderegg commented 2 years ago

I completely reinstalled the MACH-framework and it worked without this problem. Because of that and the feedback above, I assume there was something wrong on my system. So I am closing this.