ParticulateFlow / LIGGGHTS-PFM

This is an academic adaptation of the LIGGGHTS software package, released by the Department of Particulate Flow Modelling at Johannes Kepler University in Linz, Austria http://www.jku.at/pfm
GNU General Public License v2.0
47 stars 39 forks source link

Build failing for mpi_liggghts.cpp #6

Closed kolarji2 closed 2 years ago

kolarji2 commented 2 years ago

Build of the current LIGGGHTS-PFM is failing for mpi_liggghts.cpp.

Archlinux 2022.01.01 gcc (GCC) 11.1.0 -- Found MPI_C: /usr/lib/openmpi/libmpi.so (found version "3.1") -- Found MPI_CXX: /usr/lib/openmpi/libmpi_cxx.so (found version "3.1") -- Found MPI: TRUE (found version "3.1")

Edit: This is caused by the new version gcc 10+.

[ 75%] Building CXX object CMakeFiles/liggghts.dir/mpi_liggghts.cpp.o
/home/jiri/apps/cfdem-pfm/LIGGGHTS-PFM/src/mpi_liggghts.cpp: In function ‘void LAMMPS_NS::mpi_abs_min_op(void*, void*, int*, ompi_datatype_t**)’:
/home/jiri/apps/cfdem-pfm/LIGGGHTS-PFM/src/mpi_liggghts.cpp:85:5: error: ‘printf’ was not declared in this scope
   85 |     printf("unsupported data type\n");
      |     ^~~~~~
/home/jiri/apps/cfdem-pfm/LIGGGHTS-PFM/src/mpi_liggghts.cpp:32:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
   31 | #include <algorithm>
  +++ |+#include <cstdio>
   32 | 
/home/jiri/apps/cfdem-pfm/LIGGGHTS-PFM/src/mpi_liggghts.cpp: In function ‘void LAMMPS_NS::mpi_abs_max_op(void*, void*, int*, ompi_datatype_t**)’:
/home/jiri/apps/cfdem-pfm/LIGGGHTS-PFM/src/mpi_liggghts.cpp:134:5: error: ‘printf’ was not declared in this scope
  134 |     printf("unsupported data type\n");
      |     ^~~~~~
/home/jiri/apps/cfdem-pfm/LIGGGHTS-PFM/src/mpi_liggghts.cpp:134:5: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
make[2]: *** [CMakeFiles/liggghts.dir/build.make:4696: CMakeFiles/liggghts.dir/mpi_liggghts.cpp.o] Error 1
danielque commented 2 years ago

A simple #include of <stdio.h> should fix this problem. Our CI setup is using an older gcc version and did not show this issue.

kolarji2 commented 2 years ago

I confirm, after following modifications build was succesful: _src/mpi_liggghts.h and src/mpiliggghts.cpp: #include <cstdio>

_/src/region_mesh_hex.h and /src/region_meshhex.cpp #include <vector>