[mpich2-dev] I would like to ask a question about the mpibzip2

Darius Buntinas buntinas at mcs.anl.gov
Fri Apr 3 10:03:54 CDT 2009


the -c flag to the compiler specifies that linking step should not be
done and to instead generate an object file.  To generate an executable,
remove the -c flag.

Also, I see that you're compiling a c++ file (.cpp).  You should use the
 mpicxx compiler wrapper instead.  Finally, when you use an mpi compiler
wrapper (like mpicc or mpicxx, etc), you don't need the -lmpi flag.  The
compiler wrapper adds the necessary flags for mpi.

-d

On 04/02/2009 11:46 PM, 陈炜钊 wrote:
> Hello
> I would like to ask a question about the mpich2. When I use mpibzip2,
> Makefile of mpibzip2 told me to use this parameter -lmpi. but the
> linux prompted the error mpicpp. I would like to ask how I can let my
> mpich2 to use this parameter -lmpi. Error as follows
> [nisuser1 at master mpibzip2-0.6]$ ls
> AUTHORS  ChangeLog  COPYING  Makefile  Makefile~  MakefileBak 
> mpibzip2.1  mpibzip2.cpp  mybin  README  README~
> [nisuser1 at master mpibzip2-0.6]$ mpicc -c -O2 -o mpibzip2 mpibzip2.cpp
> -lbz2 -lmpi -lpthread
> gcc: -lbz2: linker input file unused because linking not done
> gcc: -lmpi: linker input file unused because linking not done
> gcc: -lpthread: linker input file unused because linking not done
> [nisuser1 at master mpibzip2-0.6]$
> [nisuser1 at master mpibzip2-0.6]$
> [nisuser1 at master mpibzip2-0.6]$ mpich2version
> MPICH2 Version:         1.0.8
> MPICH2 Release date:    Unknown, built on Mon Mar  9 08:21:54 CST 2009
> MPICH2 Device:          ch3:sock
> MPICH2 configure:       --prefix=/opt/mpich2
> MPICH2 CC:      gcc  -O2
> MPICH2 CXX:     c++  -O2
> MPICH2 F77:     gfortran  -O2
> MPICH2 F90:     f95  -O2
> [nisuser1 at master mpibzip2-0.6]$
> 
> 
> 
> 
> 
> 
> ----------
> 我的主页:www.jetstudio.cn
> 我的blog:blog.jetstudio.cn
> 邮箱发送时间2009年4月3日
> ----------


More information about the mpich2-dev mailing list