Topic: Failed compilation latest master from github

Dear all,
The latest oofem fails from Mikaels latest github branch, due to the new function giveProperty in boundaryLoad. Any suggestions. Attached is the output

In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/string:40,
                 from /home/srinath/oofem_latest.git/src/oofemlib/femcmpnn.h:44,
                 from /home/srinath/oofem_latest.git/src/oofemlib/generalboundarycondition.h:38,
                 from /home/srinath/oofem_latest.git/src/oofemlib/load.h:38,
                 from /home/srinath/oofem_latest.git/src/oofemlib/boundaryload.h:38,
                 from /home/srinath/oofem_latest.git/src/oofemlib/boundaryload.C:35:
/usr/include/c++/5/bits/stl_pair.h: In instantiation of ‘constexpr std::pair<_T1, _T2>::pair() [with _T1 = const std::__cxx11::basic_string<char>; _T2 = oofem::FunctionArgument]’:
/home/srinath/oofem_latest.git/src/oofemlib/boundaryload.C:157:53:   required from here
/usr/include/c++/5/bits/stl_pair.h:109:25: error: no matching function for call to ‘oofem::FunctionArgument::FunctionArgument()’
       : first(), second() { }
                         ^
In file included from /home/srinath/oofem_latest.git/src/oofemlib/boundaryload.C:36:0:
/home/srinath/oofem_latest.git/src/oofemlib/function.h:80:5: note: candidate: oofem::FunctionArgument::FunctionArgument(oofem::IntArray)
     FunctionArgument(IntArray val) : type(FAT_IntArray),  val0(0), val1(), val2(0), val3(std::move(val)) { }
     ^
/home/srinath/oofem_latest.git/src/oofemlib/function.h:80:5: note:   candidate expects 1 argument, 0 provided
/home/srinath/oofem_latest.git/src/oofemlib/function.h:79:5: note: candidate: oofem::FunctionArgument::FunctionArgument(int)
     FunctionArgument(int val) : type(FAT_int),  val0(0), val1(), val2(val), val3() { }
     ^
/home/srinath/oofem_latest.git/src/oofemlib/function.h:79:5: note:   candidate expects 1 argument, 0 provided
/home/srinath/oofem_latest.git/src/oofemlib/function.h:78:5: note: candidate: oofem::FunctionArgument::FunctionArgument(oofem::FloatArray)
     FunctionArgument(FloatArray val) : type(FAT_FloatArray),  val0(0), val1(std::move(val)), val2(0), val3() { }
     ^
/home/srinath/oofem_latest.git/src/oofemlib/function.h:78:5: note:   candidate expects 1 argument, 0 provided
/home/srinath/oofem_latest.git/src/oofemlib/function.h:77:5: note: candidate: oofem::FunctionArgument::FunctionArgument(double)
     FunctionArgument(double val) : type(FAT_double), val0(val), val1(), val2(0), val3() { }
     ^
/home/srinath/oofem_latest.git/src/oofemlib/function.h:77:5: note:   candidate expects 1 argument, 0 provided
/home/srinath/oofem_latest.git/src/oofemlib/function.h:59:20: note: candidate: oofem::FunctionArgument::FunctionArgument(const oofem::FunctionArgument&)
 class OOFEM_EXPORT FunctionArgument
                    ^
/home/srinath/oofem_latest.git/src/oofemlib/function.h:59:20: note:   candidate expects 1 argument, 0 provided
/home/srinath/oofem_latest.git/src/oofemlib/function.h:59:20: note: candidate: oofem::FunctionArgument::FunctionArgument(oofem::FunctionArgument&&)
/home/srinath/oofem_latest.git/src/oofemlib/function.h:59:20: note:   candidate expects 1 argument, 0 provided
src/oofemlib/CMakeFiles/core.dir/build.make:5054: recipe for target 'src/oofemlib/CMakeFiles/core.dir/boundaryload.C.o' failed
make[2]: *** [src/oofemlib/CMakeFiles/core.dir/boundaryload.C.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:1315: recipe for target 'src/oofemlib/CMakeFiles/core.dir/all' failed

Re: Failed compilation latest master from github

Which compiler is this?

Re: Failed compilation latest master from github

gcc 5.4

Re: Failed compilation latest master from github

Once again i am using gcc5.4.0


I temporarily got it compile by adding a dummy default constructor in function.h. I think it is missing anyway. Please let me know.
This is my code. I am not using the transport solver, so i dont think this should affect anything. But if it does please let me know.

 FunctionArgument() : type(FAT_double), val0(0.0), val1(), val2(0), val3() { }

Re: Failed compilation latest master from github

That constructor shouldn't exist.

I think the issue you see if caused by ScalarFunction::eval not taking a const ref of "valDict".

Re: Failed compilation latest master from github

I am not sure what the solution is. Is there one or a workaround or a hack to take care of this ??

Re: Failed compilation latest master from github

The solution should be to make valDict a const ref.

Re: Failed compilation latest master from github

Did that and still getting the same compilation errors

I made the following changes
1) scalarfunction.h

double eval(const std :: map< std :: string, FunctionArgument >&valDict, Domain *d) const;

2) scalarafunction.C

double
ScalarFunction :: eval(const std :: map< std :: string, FunctionArgument >&valDict, Domain *d) const

Re: Failed compilation latest master from github

I'm pretty sure this is actually a compiler bug. It's not present in 6.2. Try
return this->giveProperty(aProperty, tStep, {});

Re: Failed compilation latest master from github

The following fixed the problem in boundaryLoad.C.

return this->giveProperty(aProperty, tStep, {});

Original code was

return this->giveProperty(aProperty, tStep, {{}});


gcc 6.2 works as you mentioned, but my current redhat on my cluster very old distribution cannot compile gcc6.2. I highly doubt that gcc5.4 does not have the c++11 definitions. It is a pretty recent release and in fact is the defacto standard compiler with ubuntu latest.

Re: Failed compilation latest master from github

Yea, I had some messed up flags when i tried to test the compilation (you were to quick to read my reply)

Also, I must say it's very strange to rely on RPM packages for, well, almost any software on clusters. Aren't you using a module system for compilers?

Re: Failed compilation latest master from github

I am not relying on modules on my cluster, everything is compiled from source and for some reason gcc6.2 is complaining about libc version. So i am stuck with gcc5.4. My cluster is almost 6 years old. That's why.

Thanks a lot anyway.