HPSCTerrSys / eCLM

Fork of Community Land Model v5.0
https://hpscterrsys.github.io/eCLM/
Other
8 stars 13 forks source link

gcc: error: unrecognized command-line option '-V' #13

Closed AdrienDams closed 2 years ago

AdrienDams commented 2 years ago

I am trying to build eCLM on DKRZ/Levante.

However, I quickly have an error in the build. Can you help me?

Here is my error message:

[  1%] Performing configure step for 'mct_external'
checking whether the C compiler works... no
configure: error: in `/work/aa0049/a271098_tmp/eCLM/src/externals/mct':
configure: error: C compiler cannot create executables
See `config.log' for more details
gmake[2]: *** [externals/CMakeFiles/mct_external.dir/build.make:125: externals/mct/src/mct_external-stamp/mct_external-configure] Error 77
gmake[1]: *** [CMakeFiles/Makefile2:269: externals/CMakeFiles/mct_external.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2

CMakeCache.txt config.log

kvrigor commented 2 years ago

I've just tried building on Levante and encountered plenty of cryptic errors like this. After some experimentation this recipe worked:

# Load modules
module purge
module load git
module load intel-oneapi-compilers/2022.0.1-gcc-11.2.0
module load intel-oneapi-mpi/2021.5.0-gcc-11.2.0
module load intel-oneapi-mkl/2022.0.1-gcc-11.2.0
module load netcdf-c/4.8.1-openmpi-4.1.2-intel-2021.5.0
module load netcdf-fortran/4.5.3-openmpi-4.1.2-intel-2021.5.0
module load parallel-netcdf/1.12.2-openmpi-4.1.2-intel-2021.5.0

# Configure
BUILD_DIR=bld
INSTALL_DIR=install
export MPIFC=mpiifort
cmake -S src -B "$BUILD_DIR" \
      -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
      -DCMAKE_C_COMPILER=mpiicc \
      -DCMAKE_Fortran_COMPILER=mpiifort

# Build and install
cmake --build "$BUILD_DIR"
cmake --install "$BUILD_DIR"

Could you verify if this also works for you?

AdrienDams commented 2 years ago

Only the last line is not working, error message:

[a271098@levante6 eCLM]$ cmake --install "$BUILD_DIR"
-- Install configuration: "RELEASE"
-- Installing: /usr/local/lib/libgptl.a
CMake Error at bld/externals/cmake_install.cmake:46 (file):
  file INSTALL cannot copy file
  "/work/aa0049/a271098_tmp/eCLM/bld/externals/gptl/lib/libgptl.a" to
  "/usr/local/lib/libgptl.a": Permission denied.
Call Stack (most recent call first):
  bld/cmake_install.cmake:47 (include)

Did you have this permission issue too?

Thank you a lot for helping me that much! You saved me a lot of time.

kvrigor commented 2 years ago

The INSTALL_DIR should be set to an existing folder where you have write permissions. Try to run another build like this:

INSTALL_DIR=$HOME/eclm  # change this to another folder that you own
BUILD_DIR=bld           # you can also change this to any folder

rm -rf $BUILD_DIR       # discard previous build so we could run a fresh build
mkdir -p $INSTALL_DIR   # make sure $INSTALL_DIR exists

cmake -S src -B "$BUILD_DIR" \
      -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
      -DCMAKE_C_COMPILER=mpiicc \
      -DCMAKE_Fortran_COMPILER=mpiifort

cmake --build "$BUILD_DIR"
cmake --install "$BUILD_DIR"
AdrienDams commented 2 years ago

It's working now, thanks!