Trouble compiling & link fortran source code to lammps library interface

Dear users,

opensuse tumbleweed SO,
lammps-29Sep2021 version,
ifort version 2021.9.0
icc version 2021.9.0
gcc version 12.2.1 20220830

I am trying to compile my fortran source code to lammps interface.
I followed the steps found in README file at examples/COUPLE/fortran2.
Until the step (4), everthing was OK, but for step 5,
(5) Compile your program, such as,
mpif90 -I${LAMMPS_SRC}/examples/COUPLE/fortran2 -c myfreeformatfile.f90

I obtained errors in compilation:
4 | TYPE(lammps) :: lmp ! derived type to hold LAMMPS instance
| 1
Error: Derived type ‘lammps’ at (1) is being used before it is defined
testlib2.f90:19:35:
10 | CALL lmp%file(‘in.melt’)
| 1
Error: VARIABLE attribute of ‘lmp’ conflicts with PROCEDURE attribute at (1)
testcmd.f90:11:10:

etc.

files in examples/COUPLE/fortran2 folder:

in.simple
LAMMPS.F90
lammps.mod
LAMMPS.o
LAMMPS-wrapper.cpp
LAMMPS-wrapper.h
LAMMPS-wrapper.o
liblammps.a
liblammps_fortran.a
liblammps_fortran.so
liblammps_intel_cpu_intelmpi.a
liblammps_intel_cpu_openmpi.a
liblammps.mod
liblammps_mpi.a
libmpi_stubs.a
makefile
readme
simple.f90
testcmd.f90
testelib2.f90
testlib2.f90
testlib3.f90
testlib.f90

I used the following compilation command:

mpif90 -I/home/david/downloads/lammps-29Sep2021/examples/COUPLE/fortran2 -c testcmd.f90

testcmd.f90:3:15:

3 |   TYPE(lammps) :: lmp
  |               1

Error: Derived type ‘lammps’ at (1) is being used before it is defined
testcmd.f90:10:10:

10 | CALL lmp%file(‘in.melt’)
| 1
Error: VARIABLE attribute of ‘lmp’ conflicts with PROCEDURE attribute at (1)
testcmd.f90:11:10:

11 | CALL lmp%command(‘variable zpos index 1.0’)
| 1
Error: VARIABLE attribute of ‘lmp’ conflicts with PROCEDURE attribute at (1)
testcmd.f90:19:10:

19 | CALL lmp%commands_list(cmdlist)
| 1
Error: VARIABLE attribute of ‘lmp’ conflicts with PROCEDURE attribute at (1)
testcmd.f90:25:10:

25 | CALL lmp%commands_string(cmds)
| 1
Error: VARIABLE attribute of ‘lmp’ conflicts with PROCEDURE attribute at (1)
testcmd.f90:26:10:

26 | CALL lmp%close(.TRUE.)
| 1
Error: VARIABLE attribute of ‘lmp’ conflicts with PROCEDURE attribute at (1)

Please, could anyone help me to solve this issue?

Thanks in advance for your support,

This Fortran wrapper is obsolete and unsupported.

Please upgrade to the latest LAMMPS feature release (15 June 2023) and use the supported Fortran interface in the fortran folder. For more information, please see 1.3.1. The LIBLAMMPS Fortran Module — LAMMPS documentation

I would also recommend to first use gcc/gfortran only and attempt to use the Intel compilers only after you were successful with the GNU compilers.