Compilation Error

#1

Hello,
trying to install latest FF++ master on CentOS Linux release 7.4.1708 (Core) with cc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3) foowing instructions here : https://github.com/FreeFem/FreeFem-sources
Got these errors which crash the compilation process:

/usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/types/hmatrix.hpp:847:12: **error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]**
  MPI_Reduce(&(mytime[0]), &(maxtime[0]), 4, MPI_DOUBLE, MPI_MAX, 0,comm);
  ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/../misc/user.hpp:10:0,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/../misc/parametres.hpp:5,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/cluster.hpp:6,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/lrmat.hpp:5,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/partialACA.hpp:9,
                 from htool.cpp:8:
/opt/ScaleMP/mpich2/1.4/include/mpi.h:636:5: note:   initializing argument 1 of ‘int MPI_Reduce(void*, void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm)’
 int MPI_Reduce(void* , void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm);
     ^~~~~~~~~~
In file included from htool.cpp:10:0:
/usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/types/hmatrix.hpp:848:12: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
  MPI_Reduce(&(mytime[0]), &(meantime[0]), 4, MPI_DOUBLE, MPI_SUM, 0,comm);
  ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/../misc/user.hpp:10:0,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/../misc/parametres.hpp:5,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/cluster.hpp:6,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/lrmat.hpp:5,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/partialACA.hpp:9,
                 from htool.cpp:8:
/opt/ScaleMP/mpich2/1.4/include/mpi.h:636:5: note:   initializing argument 1 of ‘int MPI_Reduce(void*, void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm)’
 int MPI_Reduce(void* , void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm);
     ^~~~~~~~~~
In file included from htool.cpp:10:0:
/usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/types/hmatrix.hpp: In instantiation of ‘void htool::HMatrix<LowRankMatrix, T>::ComputeInfos(const std::vector<double>&) [with LowRankMatrix = htool::partialACA; T = std::complex<double>]’:
/usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/types/hmatrix.hpp:243:14:   required from ‘void htool::HMatrix<LowRankMatrix, T>::build(htool::IMatrix<T>&, const std::vector<std::array<double, 3ul> >&, const std::vector<double>&, const std::vector<int>&, const std::vector<double>&, const std::vector<std::array<double, 3ul> >&, const std::vector<double>&, const std::vector<int>&, const std::vector<double>&, MPI_Comm) [with LowRankMatrix = htool::partialACA; T = std::complex<double>; MPI_Comm = int]’
/usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/types/hmatrix.hpp:280:2:   required from ‘htool::HMatrix<LowRankMatrix, T>::HMatrix(htool::IMatrix<T>&, const std::vector<std::array<double, 3ul> >&, const std::vector<std::array<double, 3ul> >&, const int&, MPI_Comm) [with LowRankMatrix = htool::partialACA; T = std::complex<double>; MPI_Comm = int]’
htool.cpp:197:10:   required from ‘AnyType SetHMatrix(Stack, Expression, Expression, int) [with LR = htool::partialACA; K = std::complex<double>; AnyType = AnyTypeWithOutCheck; Stack = void*; Expression = E_F0*]’
htool.cpp:206:26:   required from ‘AnyType SetHMatrix(Stack, Expression, Expression) [with LR = htool::partialACA; K = std::complex<double>; int init = 1; AnyType = AnyTypeWithOutCheck; Stack = void*; Expression = E_F0*]’
htool.cpp:456:2:   required from ‘void add(const char*) [with LR = htool::partialACA; K = std::complex<double>]’
htool.cpp:484:56:   required from here
/usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/types/hmatrix.hpp:847:12: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
  MPI_Reduce(&(mytime[0]), &(maxtime[0]), 4, MPI_DOUBLE, MPI_MAX, 0,comm);
  ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/../misc/user.hpp:10:0,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/../misc/parametres.hpp:5,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/cluster.hpp:6,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/lrmat.hpp:5,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/partialACA.hpp:9,
                 from htool.cpp:8:
/opt/ScaleMP/mpich2/1.4/include/mpi.h:636:5: note:   initializing argument 1 of ‘int MPI_Reduce(void*, void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm)’
 int MPI_Reduce(void* , void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm);
     ^~~~~~~~~~
In file included from htool.cpp:10:0:
/usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/types/hmatrix.hpp:848:12: error: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
  MPI_Reduce(&(mytime[0]), &(meantime[0]), 4, MPI_DOUBLE, MPI_SUM, 0,comm);
  ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/../misc/user.hpp:10:0,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/../misc/parametres.hpp:5,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/../clustering/cluster.hpp:6,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/lrmat.hpp:5,
                 from /usr/local/FreeFem-sources-master/3rdparty/include/htool/include/htool/lrmat/partialACA.hpp:9,
                 from htool.cpp:8:
/opt/ScaleMP/mpich2/1.4/include/mpi.h:636:5: note:   initializing argument 1 of ‘int MPI_Reduce(void*, void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm)’
 int MPI_Reduce(void* , void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm);
     ^~~~~~~~~~
Makefile:630: recipe for target 'htool.so' failed
make[2]: *** [htool.so] Error 1
make[2]: *** Waiting for unfinished jobs....

/opt/ScaleMP/mpich2/1.4/bin/mpic++ -shared -fPIC -g -DNDEBUG -O3 -mmmx -mavx -std=c++11 -DBAMG_LONG_LONG -DNCHECKPTR -fPIC -I/usr/local/FreeFem-sources-master/3rdparty/include 'parmetis.o' -o parmetis.so '-L/opt/ScaleMP/mpich2/1.4/lib' -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib '-lmpichcxx' '-lmpich' '-lopa' '-lmpl' '-lrt' '-lpthread' '-L/usr/local/FreeFem-sources-master/3rdparty/lib/parmetis' '-lparmetis' '-lmetis' -L/opt/ScaleMP/mpich2/1.4/lib -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib -lmpichcxx -lmpich -lopa -lmpl -lrt -lpthread


/opt/ScaleMP/mpich2/1.4/bin/mpic++ -shared -fPIC -g -DNDEBUG -O3 -mmmx -mavx -std=c++11 -DBAMG_LONG_LONG -DNCHECKPTR -fPIC -I/usr/local/FreeFem-sources-master/3rdparty/include 'MPICG.o' -o MPICG.so '-L/opt/ScaleMP/mpich2/1.4/lib' -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib '-lmpichcxx' '-lmpich' '-lopa' '-lmpl' '-lrt' '-lpthread' -L/opt/ScaleMP/mpich2/1.4/lib -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib -lmpichcxx -lmpich -lopa -lmpl -lrt -lpthread


/opt/ScaleMP/mpich2/1.4/bin/mpic++ -shared -fPIC -g -DNDEBUG -O3 -mmmx -mavx -std=c++11 -DBAMG_LONG_LONG -DNCHECKPTR -fPIC -I/usr/local/FreeFem-sources-master/3rdparty/include 'MUMPS.o' -o MUMPS.so '-L/usr/local/FreeFem-sources-master/3rdparty/lib' '-ldmumpsFREEFEM' '-lzmumpsFREEFEM' '-lmumps_commonFREEFEM' '-lpordFREEFEM' '-lpthread' '-L/usr/local/FreeFem-sources-master/3rdparty/lib/parmetis' '-lparmetis' '-lmetis' '-L/usr/local/FreeFem-sources-master/3rdparty/lib' '-lesmumps' '-lptscotch' '-lptscotcherr' '-L/usr/local/FreeFem-sources-master/3rdparty/lib' '-lesmumps' '-lscotch' '-lscotcherr' '-L/usr/local/FreeFem-sources-master/3rdparty/lib' '-lscalapack' '-lblas' '-L/opt/ScaleMP/mpich2/1.4/lib' '-lmpichf90' -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib '-lmpichf90' '-lmpich' '-lopa' '-lmpl' '-lrt' '-lpthread' /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.3.1/libgfortran.so /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.3.1/libquadmath.so '-L/opt/ScaleMP/mpich2/1.4/lib' -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib '-lmpichcxx' '-lmpich' '-lopa' '-lmpl' '-lrt' '-lpthread' '-lpthread' -L/opt/ScaleMP/mpich2/1.4/lib -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib -lmpichcxx -lmpich -lopa -lmpl -lrt -lpthread

/opt/ScaleMP/mpich2/1.4/bin/mpic++ -shared -fPIC -g -DNDEBUG -O3 -mmmx -mavx -std=c++11 -DBAMG_LONG_LONG -DNCHECKPTR -fPIC -I/usr/local/FreeFem-sources-master/3rdparty/include 'cmaes.o' 'mpi-cmaes.o' -o mpi-cmaes.so '-L/opt/ScaleMP/mpich2/1.4/lib' -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib '-lmpichcxx' '-lmpich' '-lopa' '-lmpl' '-lrt' '-lpthread' -L/opt/ScaleMP/mpich2/1.4/lib -Wl,-rpath -Wl,/opt/ScaleMP/mpich2/1.4/lib -lmpichcxx -lmpich -lopa -lmpl -lrt -lpthread


make[2]: Leaving directory '/usr/local/FreeFem-sources-master/plugin/mpi'
Makefile:665: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/usr/local/FreeFem-sources-master'
Makefile:614: recipe for target 'all' failed
make: *** [all] Error 2
[root@math5 FreeFem-sources-master]# make -j16^C
[root@math5 FreeFem-sources-master]# gcc -V
gcc: error: unrecognized command line option ‘-V’
gcc: fatal error: no input files
compilation terminated.
(Simon Garnotel) #2

It seems to be a bug in htool, can you try using --enable_htool=no during the configuration process?

#3

Hello, thanks for this quick answer. Meantime, as suggested the compilation output, i added “-fpermissive” to g++ flags in order to see if the whole compilation ends correctly. It works, also the make check is OK. Yes i know it’s dirty trick…
In fact I think after many checks that it seems more related to the version of MPICH2. We use a ScaleMP patched version:
mpich2-1.4-vSMP3.5.20_20150819.el5.x86_64.rpm as part of the software bundle for our cluster.
I’ve seen that these version of MPICH2 use a void* for the first argument:
/opt/ScaleMP/mpich2/1.4/include/mpi.h:int MPI_Reduce(void* , void*, int, MPI_Datatype, MPI_Op, int, MPI_Comm);
but the FF++ expect a const void* . So may be it’s related to the version of our MPICH2. As it’s part of the ScaleMP bundle we have to check with them how to get a newer version of MPICH2.
Thank you for your time
ps: So may be it could be interesting to check the version of MPICH2 during the config process, what do you think about ?
Nice day
JM