[mpich2-dev] CFLAGS ordering in mpicc

Anthony Chan chan at mcs.anl.gov
Wed Jun 25 12:05:12 CDT 2008


Hi Joe,

The problem here is that you used CFLAGS to set dcmf/spi include directory when configuring
MPICH2.  mpicc and friends generated by configure has this line during linking/compiling( as you've pointed out)

$Show $CC $CFLAGS $allargs -I$includedir

user's include path will be in $allargs.  This causes a problem because dcmf/spi
is in CFLAGS before user's.  Swapping $CFLAGS and $allargs in mpicc.in and friends 
could solve the problem, but then it may cause portability issue for MPICH2 on other
platforms(especially with mpif77/mpif90....).   I wonder if you could use MPICH2LIB_CFLAGS
and friends to point to dcmf/spi headers when configuring MPICH2 with dcmfd.  That way mpicc and friends won't have -I/bgsys/drivers/ppcfloor/comm/sys/include.  If users want to include dcmf/spi
headers with mpicc and friends, they could include the headers explicitly.  Main thing here
is that mpicc (mpixlc in your case) are for compiling MPI programs, so i would naively think
you don't need -I/bgsys/drivers/ppcfloor/comm/sys/include unless your mpi.h contains references
to dcmf/spi symbols....

PS.  The user that you refered to could be me....

A.Chan

----- "Joe Ratterman" <jratt at us.ibm.com> wrote:

> We are looking at a problem reported by a user. We recently moved some
> files around in our system. Previously, various communication include
> files were located in the same dir as the MPI header files. This was
> simple for the users, but for various reasons they have been moved
> into another area, which we added to the WRAPPER_CFLAGS var via the
> CFLAGS var at configure time.
> 
> It seems that the user is having difficulty over-riding the built-in
> helper directory. For example:
> 
> mpicc -show -I/11111111111 -c foo.c -I/2222222222
> cc -I/bgsys/drivers/ppcfloor/comm/sys/include -I/11111111111 -c foo.c
> -I/2222222222 -I/bgsys/drivers/ppcfloor/comm/include
> MPI Files : /bgsys/drivers/ppcfloor/comm/include
> Other comm includes (that the user hopes to over-ride) :
> /bgsys/drivers/ppcfloor/comm/sys/include
> 
> The following are the interesting lines in the mpicc file
> 
> prefix=/bgsys/drivers/ppcfloor/comm
> includedir=${prefix}/include
> WRAPPER_CFLAGS="-I/bgsys/drivers/ppcfloor/comm/sys/include"
> CFLAGS="$WRAPPER_CFLAGS"
> $Show $CC $CFLAGS "${allargs[@]}" -I$includedir
> 
> It doesn't really seem correct (in this case anyway) to have CFLAGS
> ahead of the user args. Is there a specific reason that I am missing?
> Is it something that should be changed?
> MPICH2 Version 1.0.7
> 
> 
> Thanks,
> Joe Ratterman
> jratt at us.ibm.com




More information about the mpich2-dev mailing list