Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make issue #58

Closed
Princeofthebow opened this issue Jan 30, 2022 · 9 comments
Closed

Make issue #58

Princeofthebow opened this issue Jan 30, 2022 · 9 comments

Comments

@Princeofthebow
Copy link

Princeofthebow commented Jan 30, 2022

Hello after running make I get the following error:

In file included from /home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:1:
/home/jpk/Desktop/AI-Toolbox-master/include/AIToolbox/Factored/MDP/Algorithms/Utils/FactoredLP.hpp:76:18: error: ‘optional’ in namespace ‘std’ does not name a template type
   76 |             std::optional<Vector> operator()(const FactoredVector & C, const FactoredVector & b, bool addConstantBasis = false);
      |                  ^~~~~~~~
/home/jpk/Desktop/AI-Toolbox-master/include/AIToolbox/Factored/MDP/Algorithms/Utils/FactoredLP.hpp:7:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
    6 | #include <AIToolbox/Factored/MDP/Types.hpp>
  +++ |+#include <optional>
    7 | 
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:32:27: error: no declaration matches ‘std::optional<Eigen::Matrix<double, -1, 1> > AIToolbox::Factored::MDP::FactoredLP::operator()(const AIToolbox::Factored::FactoredVector&, const AIToolbox::Factored::FactoredVector&, bool)’
   32 |     std::optional<Vector> FactoredLP::operator()(const FactoredVector & C, const FactoredVector & b, bool addConstantBasis) {
      |                           ^~~~~~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:32:27: note: no functions named ‘std::optional<Eigen::Matrix<double, -1, 1> > AIToolbox::Factored::MDP::FactoredLP::operator()(const AIToolbox::Factored::FactoredVector&, const AIToolbox::Factored::FactoredVector&, bool)’
In file included from /home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:1:
/home/jpk/Desktop/AI-Toolbox-master/include/AIToolbox/Factored/MDP/Algorithms/Utils/FactoredLP.hpp:35:11: note: ‘class AIToolbox::Factored::MDP::FactoredLP’ defined here
   35 |     class FactoredLP {
      |           ^~~~~~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:198:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::makeResult(AIToolbox::Factored::GenericVariableElimination<long unsigned int>::FinalFactors&&)’ defined but not used [-Wunused-function]
  198 |     void Global::makeResult(VE::FinalFactors && finalFactors) {
      |          ^~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:183:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::endCrossSum()’ defined but not used [-Wunused-function]
  183 |     void Global::endCrossSum() {
      |          ^~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:178:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::crossSum(const Factor&)’ defined but not used [-Wunused-function]
  178 |     void Global::crossSum(const Factor & f) {
      |          ^~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:168:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::beginCrossSum()’ defined but not used [-Wunused-function]
  168 |     void Global::beginCrossSum() {
      |          ^~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:159:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::initNewFactor()’ defined but not used [-Wunused-function]
  159 |     void Global::initNewFactor() {
      |          ^~~~~~
make[2]: *** [src/CMakeFiles/AIToolboxFMDP.dir/build.make:459: src/CMakeFiles/AIToolboxFMDP.dir/Factored/MDP/Algorithms/Utils/FactoredLP.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1109: src/CMakeFiles/AIToolboxFMDP.dir/all] Error 2
make: *** [Makefile:114: all] Error 2
            ^~~~~~~~

How can I overcome this?

I'm running Ubuntu 21.10 and I appear to have the required g++-10(g++ (Ubuntu 11.2.0-7ubuntu2) 11.2.0
), eigen, boost and lpsolve (installed as lpsolve dev)

@kkonevets
Copy link

Try this cmake -DCMAKE_CXX_COMPILER=g++-10 .. && make -j4

@Princeofthebow
Copy link
Author

Princeofthebow commented Jan 30, 2022

I had to alter you command a bit setting it to cmake -DCMAKE_CXX_COMPILER=g++ .. && make -j4 as g++ 11 is installed and it did not like g++-10

When I though execute this I get a similar error again, this time further down in the make progress:

[ 71%] Building CXX object test/CMakeFiles/MDP_TreeBackupLTests.dir/MDP/TreeBackupLTests.cpp.o
In file included from /home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:1:
/home/jpk/Desktop/AI-Toolbox-master/include/AIToolbox/Factored/MDP/Algorithms/Utils/FactoredLP.hpp:76:18: error: ‘optional’ in namespace ‘std’ does not name a template type
   76 |             std::optional<Vector> operator()(const FactoredVector & C, const FactoredVector & b, bool addConstantBasis = false);
      |                  ^~~~~~~~
/home/jpk/Desktop/AI-Toolbox-master/include/AIToolbox/Factored/MDP/Algorithms/Utils/FactoredLP.hpp:7:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
    6 | #include <AIToolbox/Factored/MDP/Types.hpp>
  +++ |+#include <optional>
    7 | 
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:32:27: error: no declaration matches ‘std::optional<Eigen::Matrix<double, -1, 1> > AIToolbox::Factored::MDP::FactoredLP::operator()(const AIToolbox::Factored::FactoredVector&, const AIToolbox::Factored::FactoredVector&, bool)’
   32 |     std::optional<Vector> FactoredLP::operator()(const FactoredVector & C, const FactoredVector & b, bool addConstantBasis) {
      |                           ^~~~~~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:32:27: note: no functions named ‘std::optional<Eigen::Matrix<double, -1, 1> > AIToolbox::Factored::MDP::FactoredLP::operator()(const AIToolbox::Factored::FactoredVector&, const AIToolbox::Factored::FactoredVector&, bool)’
In file included from /home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:1:
/home/jpk/Desktop/AI-Toolbox-master/include/AIToolbox/Factored/MDP/Algorithms/Utils/FactoredLP.hpp:35:11: note: ‘class AIToolbox::Factored::MDP::FactoredLP’ defined here
   35 |     class FactoredLP {
      |           ^~~~~~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:198:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::makeResult(AIToolbox::Factored::GenericVariableElimination<long unsigned int>::FinalFactors&&)’ defined but not used [-Wunused-function]
  198 |     void Global::makeResult(VE::FinalFactors && finalFactors) {
      |          ^~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:183:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::endCrossSum()’ defined but not used [-Wunused-function]
  183 |     void Global::endCrossSum() {
      |          ^~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:178:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::crossSum(const Factor&)’ defined but not used [-Wunused-function]
  178 |     void Global::crossSum(const Factor & f) {
      |          ^~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:168:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::beginCrossSum()’ defined but not used [-Wunused-function]
  168 |     void Global::beginCrossSum() {
      |          ^~~~~~
/home/jpk/Desktop/AI-Toolbox-master/src/Factored/MDP/Algorithms/Utils/FactoredLP.cpp:159:10: warning: ‘void AIToolbox::Factored::MDP::{anonymous}::Global::initNewFactor()’ defined but not used [-Wunused-function]
  159 |     void Global::initNewFactor() {
      |          ^~~~~~
make[2]: *** [src/CMakeFiles/AIToolboxFMDP.dir/build.make:459: src/CMakeFiles/AIToolboxFMDP.dir/Factored/MDP/Algorithms/Utils/FactoredLP.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1109: src/CMakeFiles/AIToolboxFMDP.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 71%] Built target MDP_SARSATests
[ 71%] Linking CXX executable POMDP_BlindStrategiesTests
[ 71%] Linking CXX executable MDP_TreeBackupLTests
[ 71%] Built target POMDP_BlindStrategiesTests
[ 71%] Built target MDP_TreeBackupLTests
make: *** [Makefile:114: all] Error 2

@kkonevets
Copy link

what does this print gcc --version?

@Princeofthebow
Copy link
Author

Princeofthebow commented Jan 30, 2022

gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

do you mean gcc or g++?

Here for g++

g++ (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

--------- EDIT

explicitly installing g++10,i.e. not 11, appears to have it go working! Perhaps writing it in the docs could be helpful as with v11 it did not work for me(which should be C20?).

@kkonevets
Copy link

Ok, personally I did't compile it with gcc11, only with gcc10, so there could be a difference and in order to compile with gcc11 guess you should #include <optional>, that means you have to modify a code base, not a good idea. So you have to install gcc10 on your machine and compile like this cmake -DCMAKE_CXX_COMPILER=g++-10 .. && make -j4

To install gcc10 in ubuntu try apt install g++-10

@kkonevets
Copy link

kkonevets commented Jan 30, 2022

--------- EDIT
explicitly installing g++10,i.e. not 11, appears to have it go working! Perhaps writing it in the docs could be helpful as with v11 it did not work for me(which should be C20?).

here you go!

@Princeofthebow
Copy link
Author

OK indeed, v10 works!

Cheers!

@Svalorzen
Copy link
Owner

Hey, thanks for the report! I had indeed forgotten to include a couple of header files, so g++-11 was rightfully complaining about it.

I've fixed and pushed the changes, so if you want to recompile with g++-11 everything should work correctly now.

@Princeofthebow
Copy link
Author

Cheers for this and congratulations on this great work!
I'm actually a Debian user and stumbled upon g++-11 as I had to pull up an Ubuntu vm :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants