[petsc-users] Compiling Fortran Code

Maahi Talukder maahi.buet at gmail.com
Wed Mar 13 18:34:57 CDT 2019


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}


#
# compile
#
main.o:
   ${FLINKER} -c $(FFLAGS) main.f  ${PETSC_LIB}
#
# 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/af256dfa/attachment.html>


More information about the petsc-users mailing list