greatspn/SOURCES

(WSL Ubuntu 20.04) Compiler errors in varorders.cpp

Arminius opened this issue · 6 comments

I'm trying to compile GreatSPN on WSL but I encountered the following errors:

[C++]  WN/SOURCE/RGMEDD3/varorders.cpp
In file included from WN/SOURCE/RGMEDD3/varorders.cpp:17:
WN/SOURCE/RGMEDD3/varorders.h:74: error: ‘metric_t::metric_t(double)’ cannot be overloaded with ‘metric_t::metric_t(cardinality_t)’
   74 |     metric_t(double d) : value_d(d), type(metric_value_type::DOUBLE) {}
      |     ^~~~~~~~
WN/SOURCE/RGMEDD3/varorders.h:73:5: note: previous declaration ‘metric_t::metric_t(cardinality_t)’
   73 |     metric_t(cardinality_t c) : value_c(c), type(metric_value_type::CARD) {}
      |     ^~~~~~~~
WN/SOURCE/RGMEDD3/varorders.h:84: error: ‘metric_t& metric_t::operator=(double)’ cannot be overloaded with ‘metric_t& metric_t::operator=(cardinality_t)’
   84 |     metric_t& operator=(double d) { *this = metric_t(d); return *this; }
      |               ^~~~~~~~
WN/SOURCE/RGMEDD3/varorders.h:83:15: note: previous declaration ‘metric_t& metric_t::operator=(cardinality_t)’
   83 |     metric_t& operator=(cardinality_t c) { *this = metric_t(c); return *this; }
      |               ^~~~~~~~
WN/SOURCE/RGMEDD3/varorders.h:232: error: default argument given for parameter 4 of ‘cardinality_t measure_swir(const std::vector<int>&, trans_span_set_t&, const std::vector<double>&, bool)’ [-fpermissive]
  232 | cardinality_t measure_swir(const std::vector<int> &varorder, trans_span_set_t& trn_set,
      |               ^~~~~~~~~~~~
WN/SOURCE/RGMEDD3/varorders.h:230:15: note: previous specification in ‘double measure_swir(const std::vector<int>&, trans_span_set_t&, const std::vector<double>&, bool)’ here
  230 | double        measure_swir(const std::vector<int> &varorder, trans_span_set_t& trn_set,
      |               ^~~~~~~~~~~~
WN/SOURCE/RGMEDD3/varorders.h:259: error: default argument given for parameter 4 of ‘cardinality_t measure_swir2(const std::vector<int>&, trans_span_set_t&, const std::vector<double>&, bool)’ [-fpermissive]
  259 | cardinality_t measure_swir2(const std::vector<int> &varorder, trans_span_set_t& trn_set,
      |               ^~~~~~~~~~~~~
WN/SOURCE/RGMEDD3/varorders.h:257:15: note: previous specification in ‘double measure_swir2(const std::vector<int>&, trans_span_set_t&, const std::vector<double>&, bool)’ here
  257 | double        measure_swir2(const std::vector<int> &varorder, trans_span_set_t& trn_set,
      |               ^~~~~~~~~~~~~
WN/SOURCE/RGMEDD3/varorders.cpp:1769: error: redefinition of ‘cardinality_t measure_weighted_event_spans(const std::vector<int>&, const std::vector<double>*)’
 1769 | measure_weighted_event_spans(const std::vector<int> &varorder, const std::vector<cardinality_t> *pW)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
WN/SOURCE/RGMEDD3/varorders.cpp:1765:1: note: ‘double measure_weighted_event_spans(const std::vector<int>&, const std::vector<double>*)’ previously defined here
 1765 | measure_weighted_event_spans(const std::vector<int> &varorder, const std::vector<double> *pW)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
WN/SOURCE/RGMEDD3/varorders.cpp: In function ‘const char* metric_name(VariableOrderMetric)’:
WN/SOURCE/RGMEDD3/varorders.cpp:1114: warning: control reaches end of non-void function [-Wreturn-type]
 1114 | }
      | ^
make: *** [Makefile:2479: objects/RGMEDD3/WN/SOURCE/RGMEDD3/varorders.o] Error 1

I did my best to install all the requirements listed in your README.md except for Spot. The following are the packages I've installed in preparation:

g++ Version 4:9.3.0-1ubuntu2
autoconf Version 2.69-11.1
automake Version 1:1.16.1-4ubuntu6
libtool Version 2.4.6-14
libgmp-dev Version 2:6.2.0+dfsg-4
libboost-dev Version 1.71.0.0ubuntu2
flex Version 2.6.4-6.2
byacc Version 20140715-1build1
ant Version 1.10.7-1
openjdk-8-jdk-headless Version 8u282-b08-0ubuntu1~20.04
graphviz Version 2.24.2-3build2
libxml++2.6-dev Version 2.40.1-3build1
libglibmm-2.4-dev Version 2.64.2-1
libglib2.0-dev Version 2.64.6-1~ubuntu20.04.1
libcolamd2 Version 1:5.7.1+dfsg-2
libglpk-dev Version 4.65-2
liblpsolve55-dev Version 5.5.0.15-4build1

I've also installed meddly by compiling its sources from GitHub (current master branch, i.e. commit a4263bc).

Do you know how to fix this error?

I'm using gcc 9.3.0, which should be able to compile any C++17 program. The only newer gcc version in existence is gcc 10.

It seems like you're onto something. Looking further back into the make output, I now noticed that there are multiple libraries it's not finding:

Makefile:149: Missing OpenMotif. Some packages will not be compiled.
Makefile:163: Missing GraphMDP library. Some packages will not be compiled.
Makefile:170: Missing libXML++-2.6 library. Some packages will not be compiled.
Makefile:177: Missing glibmm-2.4 library. Some packages will not be compiled.
Makefile:184: Missing GLPK library. Some packages will not be compiled.
Makefile:201: Missing GMP library. Some packages will not be compiled.
Makefile:219: Missing Boost C++ library. Some packages will not be compiled.
Makefile:226: Missing Spot library(spot.lrde.epita.fr/). Some packages will not be compiled.

As for where these libraries are installed, here's a list of the most important files for some of these libraries:

/usr/include/gmpxx.h
/usr/include/x86_64-linux-gnu/gmp.h
/usr/lib/x86_64-linux-gnu/libgmp.so
/usr/lib/x86_64-linux-gnu/libgmpxx.so
/usr/include/libxml++-2.6/libxml++/libxml++.h
/usr/lib/x86_64-linux-gnu/libxml++-2.6.so
/usr/include/glibmm-2.4/glibmm.h
/usr/lib/x86_64-linux-gnu/libglibmm-2.4.so
/usr/include/glpk.h
/usr/lib/x86_64-linux-gnu/libglpk.so
/usr/include/boost/* (e.g. /usr/include/boost/optional.hpp)

I'm guessing these files are not where you expect them to be?

Thanks! Make can now find these missing libraries and the build can progress further.

I now get another but unrelated error, so I'll close this issue and open another one.