Automake cannot find include files such as mpi.h

I am trying to install a code using automake.

I can configure and compile the code with GNU and Intel.

When I try to use it with my PGI env loaded, I get:

./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking setting MPIRUN... mpirun -np 2
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether pgc++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of pgc++... none
checking whether we are using the GNU C compiler... no
checking whether pgcc accepts -g... yes
checking for pgcc option to accept ISO C89... none needed
checking whether pgcc understands -c and -o together... yes
checking dependency style of pgcc... pgcc
checking whether we are using the GNU Fortran 77 compiler... no
checking whether pgfortran accepts -g... yes
checking for ranlib... ranlib
checking how to run the C preprocessor... /lib/cpp
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking mpi.h usability... no
checking mpi.h presence... no
checking for mpi.h... no
configure: error: MPI and headers required

I have the following set:

# PGI compiler bin and run-time path:

export PATH=/usr/local/pgi/linux86-64/2016/bin:${PATH}
export LD_LIBRARY_PATH="/usr/local/pgi/linux86-64/2016/lib:${LD_LIBRARY_PATH}"

# OpenMPI (PGI included) bin and run-time path:

export PATH=/usr/local/pgi/linux86-64/2016/mpi/openmpi/bin:${PATH}
export LD_LIBRARY_PATH="/usr/local/pgi/linux86-64/2016/mpi/openmpi/lib:${LD_LIBRARY_PATH}"

# Set compiler env variables for installation of packages with PGI:
export CC=pgcc
export FC=pgf90
export CXX=pgc++
export F77=pgfortran

I have also tried setting:

export CPP="pgc++ -E"
export CXXCPP="pgc++ -E"
export CPPFLAGS="-DfpgiFortran"

but then I get: “pgc++ -E” fails sanity check

Any ideas?

Hi Ron,

You most likely need to use the MPI drivers (mpicc, mpicxx, mpif90) rather than the compiler drivers or add to your compile flags the “-I<path_to_mpi_include>” flag to find the MPI header files. The compiler drivers wont add the MPI include directory by default.

“-E” preprocesses the file sending the post-processed file to stdout. Why did you add this flag? I’m guessing it’s not what you wanted.

-Mat

Mat has the best advice.

  1. Drop the definitions for CPP and CXXCPP so gnu cpp
    is used. It is what they developed the package from.

  2. unless you are building an MPI library (in which you would
    want to use the mpi.h from the MPI lib you are building),
    you should either use the mpif90/mpicc/mpic++ from the mpi
    version you wish to use, or add the mpi include directory to your
    compile flags.

export FCFLAGS=-I/ful/path/to/mpi/include/

dave