Failed to installing fenicsx with spack due to parmetis installation failed

Hello, I am installing fenics-dolfinx with spack according to the readme of dolfinx, but the installation failed due to the failed of building the library parmetis. I am using the WSL2 system in Windows 11.

My installation command:

git clone https://github.com/spack/spack.git
. ./spack/share/spack/setup-env.sh
spack env create fenicsx-env
spack env activate fenicsx-env
spack add fenics-dolfinx@0.8.0+petsc py-fenics-dolfinx cflags="-O3" fflags="-O3"
spack install

Here’s the spack build log for parmetis:

==> parmetis: Executing phase: 'cmake'
==> [2025-06-03-11:23:42.601894] '/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/cmake-3.31.6-qwaa6lq5owfcubqjoofhksolwyii7qhv/bin/cmake' '-G' 'Unix Makefiles' '-DCMAKE_INSTALL_PREFIX:STRING=/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON' '-DCMAKE_INSTALL_RPATH:STRING=/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas/lib;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas/lib64' '-DCMAKE_PREFIX_PATH:STRING=/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/cmake-3.31.6-qwaa6lq5owfcubqjoofhksolwyii7qhv;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/compiler-wrapper-1.0-tojl4i2pdrf4hsetbs5oh23bng7syhco;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/gmake-4.4.1-gjt7jhbomejrqhzdzozgkhxonujg2wlv;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/metis-5.1.0-6z7rnpfjq25uxdyrhxqewsys4wszpg6q;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/openmpi-5.0.7-kicbnglrmdemegi7ijns7m7jnof54ljo;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/numactl-2.0.18-prrlgvhpltuhrjigjilnagwvh73uu2u7;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/pmix-5.0.5-4ughucjklxs43432jocxdpivaek2ccrs;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/hwloc-2.11.1-zkhiuvlbzksjzmlxrk3t7hcfntb3mboz;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/libevent-2.1.12-f67xfy2xm4oyfnp2mq7spmauxf3bq2ge;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/libpciaccess-0.17-sytgyh6hse5s4utnbjrcxd3tbnjblfvm;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/libxml2-2.13.5-hh53ijqwqjk6cn7sf6777evaon3eagtl;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/ncurses-6.5-rwfzulrtbdijoxvauggvwvllocbzdpkp;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/openssl-3.4.1-ermxx7jsh5ddwzshpkqoehsgykhmaphp;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/libiconv-1.18-rkddxmahi3jngtmp4qdi3mikxkzoxan5;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/xz-5.6.3-lkp6tdnchlv32atjktwxdr6yvod4tjs3;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/zlib-ng-2.2.4-kfhhtboa3xewjmin4edjochapcf7327y;/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/gcc-runtime-11.4.0-vthvqi5fab4ikk5azzvuimabpqtll45a' '-DCMAKE_BUILD_TYPE:STRING=Release' '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' '-DCMAKE_POLICY_DEFAULT_CMP0090:STRING=NEW' '-DCMAKE_FIND_USE_PACKAGE_REGISTRY:BOOL=OFF' '-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON' '-DGKLIB_PATH:PATH=/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/metis-5.1.0-6z7rnpfjq25uxdyrhxqewsys4wszpg6q/include/GKlib' '-DMETIS_PATH:PATH=/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/metis-5.1.0-6z7rnpfjq25uxdyrhxqewsys4wszpg6q' '-DCMAKE_C_COMPILER:STRING=/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/openmpi-5.0.7-kicbnglrmdemegi7ijns7m7jnof54ljo/bin/mpicc' '-DCMAKE_CXX_COMPILER:STRING=/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/openmpi-5.0.7-kicbnglrmdemegi7ijns7m7jnof54ljo/bin/mpic++' '-DSHARED:BOOL=ON' '/tmp/ysy/spack-stage/spack-stage-parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas/spack-src'
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

-- The C compiler identification is unknown
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/openmpi-5.0.7-kicbnglrmdemegi7ijns7m7jnof54ljo/bin/mpicc
-- Check for working C compiler: /mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/openmpi-5.0.7-kicbnglrmdemegi7ijns7m7jnof54ljo/bin/mpicc - broken
CMake Error at /mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/cmake-3.31.6-qwaa6lq5owfcubqjoofhksolwyii7qhv/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/openmpi-5.0.7-kicbnglrmdemegi7ijns7m7jnof54ljo/bin/mpicc"

  is not able to compile a simple test program.
  
  It fails with the following output:

    Change Dir: '/tmp/ysy/spack-stage/spack-stage-parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas/spack-build-u4rcexy/CMakeFiles/CMakeScratch/TryCompile-pxxM38'
    
    Run Build Command(s): /mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/cmake-3.31.6-qwaa6lq5owfcubqjoofhksolwyii7qhv/bin/cmake -E env VERBOSE=1 /mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/gmake-4.4.1-gjt7jhbomejrqhzdzozgkhxonujg2wlv/bin/gmake -f Makefile cmTC_e575d/fast
    /mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/gmake-4.4.1-gjt7jhbomejrqhzdzozgkhxonujg2wlv/bin/gmake  -f CMakeFiles/cmTC_e575d.dir/build.make CMakeFiles/cmTC_e575d.dir/build
    gmake[1]: Entering directory '/tmp/ysy/spack-stage/spack-stage-parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas/spack-build-u4rcexy/CMakeFiles/CMakeScratch/TryCompile-pxxM38'
    Building C object CMakeFiles/cmTC_e575d.dir/testCCompiler.c.o
    /mnt/e/Applications/MPhSimu/spack/opt/spack/linux-x86_64_v4/openmpi-5.0.7-kicbnglrmdemegi7ijns7m7jnof54ljo/bin/mpicc    -o CMakeFiles/cmTC_e575d.dir/testCCompiler.c.o -c /tmp/ysy/spack-stage/spack-stage-parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas/spack-build-u4rcexy/CMakeFiles/CMakeScratch/TryCompile-pxxM38/testCCompiler.c
    /tmp/ysy/spack-stage/spack-stage-parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas/spack-build-u4rcexy/CMakeFiles/CMakeScratch/TryCompile-pxxM38/testCCompiler.c:2:3: error: #error "The CMAKE_C_COMPILER is set to a C++ compiler"
        2 | # error "The CMAKE_C_COMPILER is set to a C++ compiler"
          |   ^~~~~
    gmake[1]: *** [CMakeFiles/cmTC_e575d.dir/build.make:81: CMakeFiles/cmTC_e575d.dir/testCCompiler.c.o] Error 1
    gmake[1]: Leaving directory '/tmp/ysy/spack-stage/spack-stage-parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas/spack-build-u4rcexy/CMakeFiles/CMakeScratch/TryCompile-pxxM38'
    gmake: *** [Makefile:134: cmTC_e575d/fast] Error 2
  
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!

Spack skipped the build of petsc and fenicsx with the following warning:

==> Warning: Skipping build of petsc-3.23.2-wsjunx22rn2wq37llujlg2x2ugxwsmke since parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas failed
==> Warning: Skipping build of py-petsc4py-3.23.2-g2xn67pczytz2flo32pvj3xesxyrhk46 since petsc-3.23.2-wsjunx22rn2wq37llujlg2x2ugxwsmke failed
==> Warning: Skipping build of py-fenics-dolfinx-0.8.0-7wzogxslpx63jv4frjv55gidt47e76ng since py-petsc4py-3.23.2-g2xn67pczytz2flo32pvj3xesxyrhk46 failed
==> Warning: Skipping build of fenics-dolfinx-0.8.0-uwlvs2yl7x4istxsn2ak6i4gb22ygtnc since petsc-3.23.2-wsjunx22rn2wq37llujlg2x2ugxwsmke failed
==> Warning: Skipping build of superlu-dist-9.1.0-6ibnt2ormyfu6fagixoikthlwqv7ibry since parmetis-4.0.3-u4rcexyfvsv4bo37cjusp3a3sxtnpzas failed

here is my compiler and arch information:

# spack compilers   
-- gcc ubuntu22.04-x86_64 ---------------------------------------
gcc@11.4.0

While the other packages that depends on openmpi such as hdf5 is successfully installed.

It seems that the mpicc is broken according to the building log. I had reinstall the openmpi in spack, cleaned the cache and tried the installing command of fenicsx again, but nothing changed.

Are there any solution to this installation problem.