greatspn / SOURCES

Main repository of the GreatSPN framework
GNU General Public License v2.0
42 stars 13 forks source link

(WSL Ubuntu 20.04) Compiler errors in varorders.cpp #20

Closed Arminius closed 3 years ago

Arminius commented 3 years ago

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?

amparore commented 3 years ago

Dear Arminius, this looks like a problem with an older compiler version that does not support some modern c++ language features. I am not too familiar with WSL. Do you know if it is possible to use a newer version of g++?

--Elvio

Il giorno gio 18 feb 2021 alle ore 15:44 Arminius notifications@github.com ha scritto:

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&, trans_span_set_t&, const std::vector&, bool)’ [-fpermissive]

232 | cardinality_t measure_swir(const std::vector &varorder, trans_span_set_t& trn_set,

  |               ^~~~~~~~~~~~

WN/SOURCE/RGMEDD3/varorders.h:230:15: note: previous specification in ‘double measure_swir(const std::vector&, trans_span_set_t&, const std::vector&, bool)’ here

230 | double measure_swir(const std::vector &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&, trans_span_set_t&, const std::vector&, bool)’ [-fpermissive]

259 | cardinality_t measure_swir2(const std::vector &varorder, trans_span_set_t& trn_set,

  |               ^~~~~~~~~~~~~

WN/SOURCE/RGMEDD3/varorders.h:257:15: note: previous specification in ‘double measure_swir2(const std::vector&, trans_span_set_t&, const std::vector&, bool)’ here

257 | double measure_swir2(const std::vector &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&, const std::vector*)’

1769 | measure_weighted_event_spans(const std::vector &varorder, const std::vector *pW)

  | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

WN/SOURCE/RGMEDD3/varorders.cpp:1765:1: note: ‘double measure_weighted_event_spans(const std::vector&, const std::vector*)’ previously defined here

1765 | measure_weighted_event_spans(const std::vector &varorder, const std::vector *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-0ubuntu120.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-1ubuntu20.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?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/greatspn/SOURCES/issues/20, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLFJEXBS4UBXCHZJ2LFMWDS7URUZANCNFSM4X2NSCMA .

Arminius commented 3 years ago

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.

amparore commented 3 years ago

I have a different intuition. The problem could be caused by the fact that libgmp is not found, which is probably required by this small piece of code. This could happen due to the way the Makefile searches for the dependent libraries. Do you know where libgmp is installed? Is the Makefile complaining about a missing gmp library?

Il giorno gio 18 feb 2021 alle ore 17:08 Arminius notifications@github.com ha scritto:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/greatspn/SOURCES/issues/20#issuecomment-781453155, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLFJEVKNPFV2Y2RH4GMCX3S7U3RNANCNFSM4X2NSCMA .

Arminius commented 3 years ago

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?

amparore commented 3 years ago

I've sent a change in the Makefile for this linux library tree. could you please git pull your repo, and retry the build?

Il giorno gio 18 feb 2021 alle ore 18:06 Arminius notifications@github.com ha scritto:

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?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/greatspn/SOURCES/issues/20#issuecomment-781494363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGLFJEVR2A6H4EDGHJME5RDS7VCLHANCNFSM4X2NSCMA .

Arminius commented 3 years ago

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.