[mpich-discuss] mpich compilation issue

Rajeev Thakur thakur at mcs.anl.gov
Sun Sep 11 23:12:28 CDT 2011


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



More information about the mpich-discuss mailing list