[petsc-users] Compiling Fortran Code

Maahi Talukder maahi.buet at gmail.com
Wed Mar 13 21:05:02 CDT 2019


Hi,

Thank you all for your suggestions. I made the changes as suggested.  But
now I get the following error-
.................................................................................................................................
[maahi at CB272PP-THINK1 egrid2d]$ make egrid2d
/home/maahi/petsc/arch-linux2-c-debug/bin/mpif90 -Wall -ffree-line-length-0
-Wno-unused-dummy-argument -g  -I/home/maahi/petsc/include
-I/home/maahi/petsc/arch-linux2-c-debug/include -Ofast -fdefault-real-8 -c
-I/home/maahi/petsc/include -I/home/maahi/petsc/arch-linux2-c-debug/include
-Ofast -fdefault-real-8 main.F
-Wl,-rpath,/home/maahi/petsc/arch-linux2-c-debug/lib
-L/home/maahi/petsc/arch-linux2-c-debug/lib
-Wl,-rpath,/home/maahi/petsc/arch-linux2-c-debug/lib
-L/home/maahi/petsc/arch-linux2-c-debug/lib
-Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/7
-L/usr/lib/gcc/x86_64-redhat-linux/7 -lpetsc -lflapack -lfblas -lm
-lpthread -lstdc++ -ldl -lmpifort -lmpi -lgfortran -lm -lgfortran -lm
-lgcc_s -lquadmath -lstdc++ -ldl
main.F:6:1:

 use petscksp
 1
*Error: Non-numeric character in statement label at (1)*
main.F:6:1:

 use petscksp
 1
Error: Unclassifiable statement at (1)
make: *** [makefile:28: main.o] Error 1

.............................................................................
Any idea how to fix that?

Thanks,
Maahi Talukder


On Wed, Mar 13, 2019 at 8:44 PM Balay, Satish <balay at mcs.anl.gov> wrote:

> check petsc makefile format - for ex:
> src/tao/unconstrained/examples/tutorials/makefile
>
> Also rename your fortran sources that have petsc calls from .f to .F
>
>
> On Wed, 13 Mar 2019, Matthew Knepley via petsc-users wrote:
>
> > On Wed, Mar 13, 2019 at 7:36 PM Maahi Talukder via petsc-users <
> > petsc-users at mcs.anl.gov> wrote:
> >
> > > Dear All,
> > >
> > > I am trying to compile a Fortran code. The make is as it follows-
> > >
> > >
> > >
> ............................................................................................................................................................................................................................
> > > # Makefile for egrid2d
> > >
> > > OBJS = main.o egrid2d.o
> > >
> > > FFLAGS = -I/home/maahi/petsc/include
> > > -I/home/maahi/petsc/arch-linux2-c-debug/include -Ofast -fdefault-real-8
> > >
> > > #
> > > # link
> > > #
> > > include ${PETSC_DIR}/lib/petsc/conf/variables
> > > include ${PETSC_DIR}/lib/petsc/conf/rules
> > >
> > > egrid2d: $(OBJS)
> > >
> > > ${FLINKER}  $(OBJS)  -o egrid2d ${PETSC_LIB}
> > >
> >
> > Move this above your includes
> >
> The location is fine. Can you change OBJS to a different name - say OBJ
> [or something else] and see if that works.
>
> Satish
>
> >
> > >
> > > #
> > > # compile
> > > #
> > > main.o:
> > >    ${FLINKER} -c $(FFLAGS) main.f  ${PETSC_LIB}
> > >
> >
> > You should not need this rule.
> >
> >   Thanks,
> >
> >     Matt
> >
> >
> > > #
> > > # Common and Parameter Dependencies
> > > #
> > >
> > > main.o:        main.f        par2d.f
> > > egrid2d.o:     egrid2d.f     par2d.f
> > >
> > >
> .....................................................................................................................................................................................................................................
> > >
> > > But I get the following error-
> > >
> > >
> > >
> ..............................................................................................................................................................................
> > > /home/maahi/petsc/arch-linux2-c-debug/bin/mpif90 -Wall
> > > -ffree-line-length-0 -Wno-unused-dummy-argument -g
> > > -I/home/maahi/petsc/include
> -I/home/maahi/petsc/arch-linux2-c-debug/include
> > > -Ofast -fdefault-real-8      -o egrid2d
> > > -Wl,-rpath,/home/maahi/petsc/arch-linux2-c-debug/lib
> > > -L/home/maahi/petsc/arch-linux2-c-debug/lib
> > > -Wl,-rpath,/home/maahi/petsc/arch-linux2-c-debug/lib
> > > -L/home/maahi/petsc/arch-linux2-c-debug/lib
> > > -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/7
> > > -L/usr/lib/gcc/x86_64-redhat-linux/7 -lpetsc -lflapack -lfblas -lm
> > > -lpthread -lstdc++ -ldl -lmpifort -lmpi -lgfortran -lm -lgfortran -lm
> > > -lgcc_s -lquadmath -lstdc++ -ldl
> > > /*usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crt1.o: In
> function
> > > `_start':*
> > > *(.text+0x20): undefined reference to `main'*
> > > collect2: error: ld returned 1 exit status
> > > make: *** [makefile:18: egrid2d] Error 1
> > >
> > >
> ........................................................................................................................................
> > >
> > > Any idea how to fix it ?
> > >
> > > Thanks,
> > > Maahi Talukder
> > >
> > >
> > >
> > >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190313/b21f48ff/attachment.html>


More information about the petsc-users mailing list