[mpich-discuss] GFORTRAN on MinGW doesn't link to MPICH-2

Miao Li rockymountai at gmail.com
Wed Sep 17 10:43:04 CDT 2014


Hello, Folks

Sorry to bug you guys with this but I am sure there are tons of people
have encountered this before, I am creating a MPI program with MPICH-2
and gfortran on Windows 8 64 with MinGW, but for some reason the
MPICH-2 can't be linked and errors are:

hello_mpi.o:hello_mpi.f90:(.text+0x10): undefined reference to `mpi_init_'
hello_mpi.o:hello_mpi.f90:(.text+0x2a): undefined reference to `mpi_comm_size_'
hello_mpi.o:hello_mpi.f90:(.text+0x44): undefined reference to `mpi_comm_rank_'
hello_mpi.o:hello_mpi.f90:(.text+0x54): undefined reference to `mpi_wtime_'
hello_mpi.o:hello_mpi.f90:(.text+0x6bd): undefined reference to `mpi_wtime_'
hello_mpi.o:hello_mpi.f90:(.text+0x7f7): undefined reference to `mpi_finalize_'
c:/users/<myid>/program_files/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe:
C:\Users\<myid>\AppData\L
ocal\Temp\cckYDcnb.o: bad reloc address 0x20 in section `.eh_frame'
c:/users/<myid>/program_files/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe:
final link failed: Inval
id operation
collect2.exe: error: ld returned 1 exit status

This is just a "hello world" program and I followed the instructions
in the README.winbin.rtf file

"

2) add –I…mpich2\include

3) add –L…mpich2\lib

"

Some people believe that the "-lmpi" option should be used at the very
end of command, I did that but doesn't help.

I even tried compiling without any makefile but just a single command like:

> gfortran.exe -I"C:\Program Files\MPICH2\include" hello_mpi.f90 -L"C:\Program Files\MPICH2\lib" -lmpi

But still it doesn't work for me.

Did any of you guys have encountered this before?

I really look forward your response, any inputs are highly appreciated!!!

Thank you so much!

Best Regard

NOTE:

Here is my simple makefile:

F90    = gfortran
MPI_DIR   = /c/Program\ Files/MPICH2
MPI_LIB_DIR  = $(MPI_DIR)/lib
MPI_LIB_INCLUDE = $(MPI_DIR)/include
MPI_LIB   = -L$(MPI_LIB_DIR) -lmpi
MPI_INCLUDE  = -I$(MPI_LIB_INCLUDE)
SRC    = hello_mpi.f90
OBJ    = $(SRC:.f90=.o)
EXEC   = hello
$(EXEC): $(OBJ)
 $(F90) -o $(EXEC)  $(OBJ) $(MPI_LIB)
$(OBJ) : $(SRC)
 $(F90) $(MPI_INCLUDE) -c $<
clean:
 rm *.o
_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list