I checked with gfortran-6 - the issue remains the same. Therefore, I do not think, it is an issue with the compiler. Which compiler do you use?
I modified ex1f.F90 in the PETSC testcase folder ($(PETSC_DIR)/src/ksp/ksp/examples/tutorials) such, that the variable declaration
KSP ksp
in line 31 of the original file is now given in a header file ksp_test.h - which works fine. For the case that this header file additionally contains a common declaration for the ksp similar to the use in feap, i.e.
KSP ksp
common /pfeapc/ ksp
then the compilation has the error
~/FEAP85/petsc-3.8.4/src/ksp/ksp/examples/tutorials$ make ex1f_mod
/home/cs/FEAP85/petsc-3.8.4/gnu-opt/bin/mpif90 -c -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g -I/home/cs/FEAP85/petsc-3.8.4/include -I/home/cs/FEAP85/petsc-3.8.4/gnu-opt/include -o ex1f_mod.o ex1f_mod.F90
/home/cs/FEAP85/petsc-3.8.4/include/petsc/finclude/ksp_test.h:1:32:
KSP ksp
1
Error: Derived type variable ‘ksp’ in COMMON at (1) has neither the SEQUENCE nor the BIND(C) attribute
make: [ex1f_mod.o] Fehler 1 (ignoriert)
/home/cs/FEAP85/petsc-3.8.4/gnu-opt/bin/mpif90 -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g -o ex1f_mod ex1f_mod.o -Wl,-rpath,/home/cs/FEAP85/petsc-3.8.4/gnu-opt/lib -L/home/cs/FEAP85/petsc-3.8.4/gnu-opt/lib -Wl,-rpath,/home/cs/FEAP85/petsc-3.8.4/gnu-opt/lib -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/6 -L/usr/lib/gcc/x86_64-linux-gnu/6 -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -lpetsc -lflapack -lfblas -lparmetis -lmetis -lX11 -lpthread -lm -lmpifort -lgfortran -lm -lgfortran -lm -lquadmath -lmpicxx -lstdc++ -lm -Wl,-rpath,/home/cs/FEAP85/petsc-3.8.4/gnu-opt/lib -L/home/cs/FEAP85/petsc-3.8.4/gnu-opt/lib -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/6 -L/usr/lib/gcc/x86_64-linux-gnu/6 -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -Wl,-rpath,/lib/x86_64-linux-gnu -L/lib/x86_64-linux-gnu -Wl,-rpath,/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -ldl -Wl,-rpath,/home/cs/FEAP85/petsc-3.8.4/gnu-opt/lib -lmpi -lgcc_s -ldl
gfortran-6: error: ex1f_mod.o: Datei oder Verzeichnis nicht gefunden
make: [ex1f_mod] Fehler 1 (ignoriert)
/bin/rm -f ex1f_mod.o
As far as I can tell, the problem here is the usage of the KSP type within the common block. Do you agree? I append the corresponding files and the modified makefile, so the compile is done via
make ex1f_mod
- is it possible for you to reproduce this error? Note that the ksp_test.h needs to be in the folder $(PETSC_DIR)/include/petsc/finclude