charm
charm copied to clipboard
Does the cmake build work with clang?
On debian linux, I do
cmake -DTARGET=LIBS -DNETWORK=mpi -DSMP=off -DCMAKE_C_COMPILER=mpicc -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_Fortran_COMPILER=gfortran <charm-src>
and I get
<...>/charmc: line 236: eval: -I: invalid option
eval: usage: eval [arg ...]
Fatal Error by charmc in directory <...>/b
Command -I<...>/b/include -DAMPI_ERRHANDLER_RETURN=0 -DNDEBUG -O3 -O3 -O2 -c <...>/b/pup_f.f90 -o CMakeFiles/conv-utilf.dir/pup_f.f90.o returned error code 2
Seems like a command is missing in charmc:236
DoNoErrCheck() {
[ -n "$VERBOSE" ] && echo "charmc: Executing $@" 1>&2
eval "$@"
}
Does someone have a workaround?
In general, I would suggest specifying compilers via environment variables, not inside the cmake options, when using cmake directly:
$ CC=mpicc CXX=mpicxx FC=gfortran cmake -DTARGET=LIBS -DNETWORK=mpi -DSMP=off <charm-src>
Does this make a difference for your build?
Edit: Also, you probably don't need to specify mpicc explicitly with the MPI network:
$ cmake -DTARGET=LIBS -DNETWORK=mpi -DSMP=off <charm-src>
As I have multiple mpi installs besides the system-wide one with gcc, e.g., with clang, I usually point cmake to non-system mpi wrappers via either env vars (as you suggest) or via cmake's args. Neither of the above helps though with the error if I have clang behind the mpi wrappers. (Though, I'm also happy with the workaround in https://github.com/UIUC-PPL/charm/pull/3646.)
That is interesting. Could you please paste the complete cmake
output in a gist and add a link here?
https://gist.github.com/jbakosi/a827cbdcab0d3bcfdc4df5874703d4e9
It only errors with -DNETWORK=mpi
.
@matthiasdiener @ebohm I have a couple of colleagues here at AMD who are trying to get Charm++ built with our clang-based AOCC compiler and are snagging in the same error described here. Do you guys have an ETA for a fix on this issue?
I'm guessing if gfortran is not installed, CMake will blank out CMAKE_Fortran_COMPILER
, and that's why the shell sees -I
as the first word in the command.
Side note, if you're using mpicc and mpicxx, I would set the Fortran compiler to mpif90 or similar.
Side note, if you're using mpicc and mpicxx, I would set the Fortran compiler to mpif90 or similar.
I usually do, but for cmake projects that do not enable fortran, this remains an issue.