[mpich-discuss] mpich compilation issue
akshar bhosale
akshar.bhosale at gmail.com
Mon Sep 12 21:49:10 CDT 2011
Hi,
thanks.
but, in case of mpicc, it can be ignored, but in case of mpif90, it is still
an issue.
e.g. hello_mpi.f90 program
####################
program main
use mpi
!
! implicit none
!
integer error
integer id
integer p
real ( kind = 8 ) wtime
!
! Initialize MPI.
!
call MPI_Init ( error )
!
! Get the number of processes.
!
call MPI_Comm_size ( MPI_COMM_WORLD, p, error )
!
! Get the individual process ID.
!
call MPI_Comm_rank ( MPI_COMM_WORLD, id, error )
!
! Print a message.
!
if ( id == 0 ) then
wtime = MPI_Wtime ( )
write ( *, '(a)' ) ' '
write ( *, '(a)' ) 'HELLO_MPI - Master process:'
write ( *, '(a)' ) ' FORTRAN90/MPI version'
write ( *, '(a)' ) ' '
write ( *, '(a)' ) ' An MPI test program.'
write ( *, '(a)' ) ' '
write ( *, '(a,i8)' ) ' The number of processes is ', p
write ( *, '(a)' ) ' '
end if
write ( *, '(a)' ) ' '
write ( *, '(a,i8,a)' ) ' Process ', id, ' says "Hello, world!"'
if ( id == 0 ) then
write ( *, '(a)' ) ' '
write ( *, '(a)' ) 'HELLO_MPI - Master process:'
write ( *, '(a)' ) ' Normal end of execution: "Goodbye, world!".'
wtime = MPI_Wtime ( ) - wtime
write ( *, '(a)' ) ' '
write ( *, '(a,g14.6,a)' ) ' Elapsed wall clock time = ', wtime, '
seconds.'
end if
!
! Shut down MPI.
!
call MPI_Finalize ( error )
stop
end
############################
$ ../../../build/bin/mpif90 hello_mpi.f90
/scratch1/np_cs/trial1/build/lib/libmpich.a(farg.o): In function
`mpir_iargc__':
farg.f:(.text+0x6): undefined reference to `f__xargc'
/scratch1/np_cs/trial1/build/lib/libmpich.a(farg.o): In function
`mpir_getarg__':
farg.f:(.text+0x38): undefined reference to `getarg_'
collect2: ld returned 1 exit status
On Mon, Sep 12, 2011 at 9:42 AM, Rajeev Thakur <thakur at mcs.anl.gov> wrote:
> Ignore that. Compile a real program as mpicc foo.c.
>
> On Sep 11, 2011, at 8:38 PM, akshar bhosale wrote:
>
> > Hi,
> > thank you for reply.
> >
> > I tried to install it make it using following options now and i get
> following error with undefined reference to main. options given while
> configuring the same are :
> > export F90=fortran;F90FLAGS="-ff2c".
> > but error of undefined reference to main is observed in every executable
> like :
> >
> > ./mpicc -v
> > mpicc for 1.2.7 (release) of : 2005/06/22 16:33:49
> > Using built-in specs.
> > Target: x86_64-redhat-linux
> > Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info --enable-shared --enable-threads=posix
> --enable-checking=release --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions --enable-libgcj-multifile
> --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
> --disable-dssi --disable-plugin
> --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
> --host=x86_64-redhat-linux
> > Thread model: posix
> > gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)
> > /usr/libexec/gcc/x86_64-redhat-linux/4.1.2/collect2 --eh-frame-hdr -m
> elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbegin.o
> -L/scratch1/np_cs/trial2/build/lib -L/opt/intel/mkl/10.2.2.025/lib/em64t-L/opt/intel/mkl/
> 10.2.2.025/lib/em64t -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2
> -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2
> -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/lib/../lib64
> -L/usr/lib/../lib64 -lmpich -lpthread -lrt -lgcc --as-needed -lgcc_s
> --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtend.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crtn.o
> > /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In
> function `_start':
> > (.text+0x20): undefined reference to `main'
> > collect2: ld returned 1 exit status
> >
> > ./mpif90 -v
> > mpif90 for 1.2.7 (release) of : 2005/06/22 16:33:49
> > Driving: gfortran -L/scratch1/np_cs/trial2/build/lib -v -lmpichf90
> -lmpich -lpthread -lrt -lgfortranbegin -lgfortran -lm -shared-libgcc
> > Using built-in specs.
> > Target: x86_64-redhat-linux
> > Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info --enable-shared --enable-threads=posix
> --enable-checking=release --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions --enable-libgcj-multifile
> --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
> --disable-dssi --disable-plugin
> --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
> --host=x86_64-redhat-linux
> > Thread model: posix
> > gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)
> > /usr/libexec/gcc/x86_64-redhat-linux/4.1.2/collect2 --eh-frame-hdr -m
> elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crti.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbegin.o
> -L/scratch1/np_cs/trial2/build/lib -L/opt/intel/mkl/10.2.2.025/lib/em64t-L/opt/intel/mkl/
> 10.2.2.025/lib/em64t -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2
> -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2
> -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/lib/../lib64
> -L/usr/lib/../lib64 -lmpichf90 -lmpich -lpthread -lrt -lgfortranbegin
> -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtend.o
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crtn.o
> > /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libgfortranbegin.a(fmain.o): In
> function `main':
> > (.text+0xa): undefined reference to `MAIN__'
> > collect2: ld returned 1 exit status
> >
> > Am i missing somethin?
> > thank you
> > -akshar
> >
> > On Mon, Sep 12, 2011 at 1:24 AM, William Gropp <wgropp at illinois.edu>
> wrote:
> > You can use gfortran for F77 and F90. If your requirement is to use
> gfortran for F77 and a different fortran for F90, then they will need to use
> consistent linker names, calling conventions, data sizes, and libraries.
> The config.log file will have details on why configure decided that the
> Fortran 77 and Fortran 90 compilers were not compatible.
> >
> > Bill
> >
> >
> > On Sep 9, 2011, at 4:28 PM, akshar bhosale wrote:
> >
> > hi,
> > we have requirement of mpich-1.2.7 with gfortran. We have fiven flags as
> : CC=gcc;F90=fortran;F77=gfortran; and tried to configure, it throws error
> as configure: error: Fortran 90 and Fortran 77 compilers are not
> compatible..
> > We have to do it using gfortran only. os is rhel5.1 64 bit
> > what extran flags settings we have to do?
> >
> > -akshar
> > _______________________________________________
> > mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> > To manage subscription options or unsubscribe:
> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> >
> > William Gropp
> > Director, Parallel Computing Institute
> > Deputy Director for Research
> > Institute for Advanced Computing Applications and Technologies
> > Paul and Cynthia Saylor Professor of Computer Science
> > University of Illinois Urbana-Champaign
> >
> >
> >
> >
> > _______________________________________________
> > mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> > To manage subscription options or unsubscribe:
> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
> _______________________________________________
> mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110913/a81889bc/attachment.htm>
More information about the mpich-discuss
mailing list