Serial Petsc .... But undefined reference to MPI_Init()?

#DOMINIC DENVER JOHN CHANDAR# DOMI0002 at ntu.edu.sg
Fri Jan 19 12:20:03 CST 2007


Hi,
   Thanks, As you said, I found that mpi.h was being obtained from
/usr/src/mpich-1.2.5 and this call was from petsc.h ..no wonder how that
came ?Anyways, I made a clean build replacing it by the mpi.h from
mpiuni/mpi.h and all went fine.

Regs,
Dominic 

-----Original Message-----
From: owner-petsc-users at mcs.anl.gov
[mailto:owner-petsc-users at mcs.anl.gov] On Behalf Of Matthew Knepley
Sent: Saturday, January 20, 2007 12:57 AM
To: petsc-users at mcs.anl.gov
Subject: Re: Serial Petsc .... But undefined reference to MPI_Init()?

Some other MPI installation is interfering with MPIUNI. In
$PETC_DIR/include/mpiuni/mpi.h, we #define MPI_Init to Petsc_MPI_Init.
Thus, in the compile of ex2.c, some other mpi.h is being picked up. You
can see which one using gcc -E.

  Matt

On 1/19/07, #DOMINIC DENVER JOHN CHANDAR# <DOMI0002 at ntu.edu.sg> wrote:
>
>
> Hi,
>
>      Ive installed the serial version of petsc couple of months back 
> sucessfully. I did it again just now on Itanium-64 with the compiler 
> options mpi=0. Just wondering, although libmpiuni.a is getting linked,

> i still get undefined ref to MPI_Init()? Any clues ?
>
> gcc -c -Wall -g3 -I/home/pdominic/petsc-2.2.1 
> -I/home/pdominic/petsc-2.2.1/bmake/linux-gnu-ia64-intel
> -I/home/pdominic/petsc-2.2.1/include
> -I/home/pdominic/petsc-2.2.1/include/mpiuni -DPETSC_USE_BOPT_g 
> -DPETSC_USE_EXTERN_CXX -D__SDIR__="src/ksp/examples/tests/"
> ex2.c
>
> gcc  -Wall -g3
> -Wl,-rpath,/home/pdominic/petsc-2.2.1/lib/libg/linux-gnu-ia64-intel
>  -o ex2 ex2.o  
> -L/home/pdominic/petsc-2.2.1/lib/libg/linux-gnu-ia64-intel
> -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc
>
>  -L/usr/X11R6/lib -lX11
>
>
>
>
> -Wl,-rpath,/usr/lib -L/usr/lib -llapack -Wl,-rpath,/usr/lib -L/usr/lib

> -lblas
> -Wl,-rpath,/usr/src/gcc-3.0.4-build2/lib/gcc-lib/ia64-unknown-linux/3.
> 0.4
> -L/usr/src/gcc-3.0.4-build2/lib/gcc-lib/ia64-unknown-linux/3.0.4
> -lg2c -L/home/pdominic/petsc-2.2.1/lib/libg/linux-gnu-ia64-intel 
> -lmpiuni -ldl -ldl -ldl -ldl -lm  -lg2c -lm
> -L/usr/local/lib/gcc-lib/ia64-unknown-linux/3.0.4
> -L/usr/local/lib/gcc-lib/ia64-unknown-linux/3.0.4/../../..
> -lm
> ex2.o: In function `main':
>
> /home/pdominic/petsc-2.2.1/src/ksp/examples/tests/ex2.c:31:
> undefined reference to `MPI_Init'
> /home/pdominic/petsc-2.2.1/src/ksp/examples/tests/ex2.c:33:
> undefined reference to `MPI_Finalize'
> collect2: ld returned 1 exit status
> make: [ex2] Error 1 (ignored)
> rm -f ex2.o
>
>
> Regards,
> Dominic


--
One trouble is that despite this system, anyone who reads journals
widely and critically is forced to realize that there are scarcely any
bars to eventual publication. There seems to be no study too fragmented,
no hypothesis too trivial, no literature citation too biased or too
egotistical, no design too warped, no methodology too bungled, no
presentation of results too inaccurate, too obscure, and too
contradictory, no analysis too self-serving, no argument too circular,
no conclusions too trifling or too unjustified, and no grammar and
syntax too offensive for a paper to end up in print. -- Drummond Rennie




More information about the petsc-users mailing list