Issues Installing MPICH on Ubuntu - Configuration and Compiler Errors

Hi,

I’m trying to install MPICH (version 3.4.2) on my Ubuntu system as part of setting up CMAQ for air quality modeling. However, I’m encountering several issues during the configuration and compilation process.

Environment:

  • Operating System: Ubuntu 24.04.1 LTS
  • Intel Compiler: Intel oneAPI (icc for C, ifort for Fortran)
  • Additional Tools: make, gcc, gfortran, hwloc libraries installed

Problem:

I am following the installation instructions for MPICH, but when I run the ./configure script, I receive the following error:

configure: error: cannot run C compiled programs.
If you meant to cross compile, use ‘–host’.
See ‘config.log’ for more details.

Additionally, I am trying to configure MPICH with Intel compilers (icc, ifort), but I also tried using gcc and gfortran without success.

Steps Taken:

  1. Checked Compilers:
  • icc and ifort are correctly installed and sourced.
  • Tried using gcc and gfortran as alternatives, but the issue persists.
  1. Set Environment Variables:
  • Added Intel compilers to the environment and sourced setvars.sh file.
  • Added required paths to .profile for GCC and other dependencies.
  1. Run ./configure: I ran the following configure command:
CC=icc CXX=icc FC=ifort CPP='icpc -E' CPPFLAGS='-fPIC' \
./configure --prefix=/home/ubuntu/Build_CMAQ/LIBRARIES/mpich --with-device=ch3

This command did not generate the Makefile and resulted in the error mentioned earlier.
4. Manual Workaround Attempts: I also tried setting --host for cross-compilation, but it didn’t resolve the issue. Here’s the configuration command I tried:

./configure --prefix=/home/ubuntu/Build_CMAQ/LIBRARIES/mpich --host=arm --with-device=ch3

But I still encounter the same issue.

Errors Encountered:

  1. ./configure fails to generate the Makefile due to the error: cannot run C compiled programs.
  2. Tried to cross-compile with --host=arm, but that also didn’t work.

What I’ve Tried:

  • Running ./configure with both Intel and GCC compilers.
  • CC=icc CXX=icc FC=ifort CPP=‘icpc -E’ CPPFLAGS=‘-fPIC’
    ./configure --prefix=/home/ubuntu/Build_CMAQ/LIBRARIES/mpich --with-device=ch3 - this didn’t worked
  • Ensuring all paths are correctly set in .profile.
  • Installing missing dependencies (e.g., hwloc, libhwloc-dev).
  • Manually setting up PATH and LD_LIBRARY_PATH.
  • I’m following this manual since it’s much easier for me to understand.

Request:

Could anyone help me troubleshoot why ./configure isn’t generating the Makefile and why I’m seeing the “cannot run C compiled programs” error?

Additionally, if anyone has experience configuring MPICH on Ubuntu with Intel compilers (or GCC), I’d greatly appreciate guidance on what steps I might be missing.

Thank you for the clear explanation of your workflow and issue.

Please look in the config.log file for the error that is generated.

grep -i error config.log

You may also need to consult the release notes for the compiler version that you used to see if a related error is mentioned.

Another alternative is to use a more recent version of the OneAPI Intel Compiler that would use ifx and icx

You should also consult the MPICH Documentation: Guides | MPICH

1 Like

You will need to review the configure.log in the

cd /home/ubuntu/Build_CMAQ/LIBRARIES/mpich
grep -i error configure.log

Please also try these settings for your compiler

# compilers
 setenv FC ifort
 setenv F77 ifort
 setenv CC icc
 setenv CXX icpc