Hi,
I am trying to build CMake 4.3.2 (NB not build with CMake) on my local university cluster.
Since there’s no CUDA module (sigh) but plenty of NVHPC compiler modules (wrapping CUDA), I am trying to build CMake using nvc and nvc++. After numerous tries, I am still unable to build CMake. This is my build script:
module purge
ml nvhpc-hpcx-cuda12/25.11
ml gcc/12.4.0
mkdir -p cmake-nvhpc
# Yes, I am building on scratch, there's no fast dedicated FS on the cluster...
INSTALL_DIR=$SCRATCH_FLASH/cmake-nvhpc
tar -xvf cmake-4.3.2.tar.gz
cd cmake-4.3.2
NVCC="/share/apps/hpc_sdk/Linux_x86_64/25.11/compilers/bin/nvc"
NVCXX="/share/apps/hpc_sdk/Linux_x86_64/25.11/compilers/bin/nvc++"
CC=$NVCC CXX=$NVCXX ./bootstrap \
--prefix=$INSTALL_DIR \
--parallel=12 \
-- \
-DCMAKE_C_COMPILER=$NVCC \
-DCMAKE_CXX_COMPILER=$NVCXX
make -j 12
make install
Despite trying my best to tell CMake to use nvc++ as C++ compiler, I still get the error:
---------------------------------------------
CMake 4.3.2, Copyright 2000-2026 Kitware, Inc. and Contributors
C compiler on this system is: /share/apps/hpc_sdk/Linux_x86_64/25.11/compilers/bin/nvc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are "".
They can be changed using the environment variable CXXFLAGS.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /mnt/beegfs/mpellegrino/cmake-4.3.2/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
Which is a bit strange since it can actually find the C compiler.
Any guess?
Before you ask: I checked that the path to /share/apps/hpc_sdk/Linux_x86_64/25.11/compilers/bin/nvc++ is the correct one.
I know I don’t need CUDA and I could just use a non-CUDA-aware compiler, but I don’t see why NVHPC would not work instead.