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

fix simulator type error on macOS #32

Merged
merged 2 commits into from
Oct 22, 2023

Conversation

TakesxiSximada
Copy link
Collaborator

@TakesxiSximada TakesxiSximada commented Oct 8, 2023

When building the simulator on macOS, the build fails due to a type error. However, this does not happen on Ubuntu.

To work around this issue, I modified the type declarations used for macOS according to the compiler output.

The contents of the error are as follows. Occurs while running python setup.py install.

this pull request includes #30 commits (for passing ci tests)

[ 87%] Building CXX object SimulatorCPP/CMakeFiles/simulator_cpp.dir/Robot.cpp.o
[ 90%] Building CXX object SimulatorCPP/CMakeFiles/simulator_cpp.dir/Sim.cpp.o
In file included from /opt/ng/evogym/evogym/simulator/SimulatorCPP/Interface.cpp:1:
In file included from /opt/ng/evogym/evogym/simulator/SimulatorCPP/Interface.h:13:
In file included from /opt/ng/evogym/evogym/simulator/SimulatorCPP/Sim.h:9:
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.h:9:23: warning: extra tokens at end of #include directive [-Wextra-tokens]
#include "SimObject.h";
                      ^
                      //
In file included from /opt/ng/evogym/evogym/simulator/SimulatorCPP/PythonBindings.cpp:3:
In file included from /opt/ng/evogym/evogym/simulator/SimulatorCPP/Interface.h:13:
In file included from /opt/ng/evogym/evogym/simulator/SimulatorCPP/Sim.h:9:
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.h:9:23: warning: extra tokens at end of #include directive [-Wextra-tokens]
#include "SimObject.h";
                      ^
                      //
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:334:49: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (top != NULL && top->point_bot_left_index != NULL)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:336:52: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (left != NULL && left->point_top_right_index != NULL)
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:338:60: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (top_left != NULL && top_left->point_bot_right_index != NULL)
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:340:38: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (current->point_top_left_index == NULL)
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:349:50: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (top != NULL && top->point_bot_right_index != NULL)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:351:53: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (right != NULL && right->point_top_left_index != NULL)
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:353:61: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (top_right != NULL && top_right->point_bot_left_index != NULL)
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:355:39: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (current->point_top_right_index == NULL)
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:364:49: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (bot != NULL && bot->point_top_left_index != NULL)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:366:52: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (left != NULL && left->point_bot_right_index != NULL)
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:368:60: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (bot_left != NULL && bot_left->point_top_right_index != NULL)
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp/opt/ng/evogym/evogym/simulator/SimulatorCPP/Environment.cpp:271:10: error: calling a private constructor of class 'Eigen::Ref<Eigen::Matrix<double, -1, -1, 0>, 0, Eigen::OuterStride<-1>>'
                return empty;
                       ^
:/opt/ng/evogym/evogym/simulator/externals/eigen/Eigen/src/Core/Ref.h:370299::3830::  warning: note: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]declared private here

    EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase<Derived>& expr,
                        if (current->point_bot_left_index == NULL)
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:380:50: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (bot != NULL && bot->point_top_right_index != NULL)
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:382:53: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (right != NULL && right->point_bot_left_index != NULL)
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:384:61: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (bot_right != NULL && bot_right->point_top_left_index != NULL)
                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:386:39: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (current->point_bot_right_index == NULL)
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:398:43: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (top != NULL && top->edge_bot_index != NULL)
                                           ~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:400:32: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (current->edge_top_index == NULL) {
                            ~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:405:43: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (bot != NULL && bot->edge_top_index != NULL)
                                           ~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:407:32: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (current->edge_bot_index == NULL) {
                            ~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
                             ^
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:412:47: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (left != NULL && left->edge_right_index != NULL)
                                            ~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:414:33: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (current->edge_left_index == NULL) {
                            ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/Environment.cpp:282:10: error: calling a private constructor of class 'Eigen::Ref<Eigen::Matrix<double, -1, -1, 0>, 0, Eigen::OuterStride<-1>>'
                return empty;
                       ^
/opt/ng/evogym/evogym/simulator/externals/eigen/Eigen/src/Core/Ref.h:299:30: note: declared private here
    EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase<Derived>& expr,
                             ^/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:419:48: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (right != NULL && right->edge_left_index != NULL)
                                             ~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.cpp:421:34: warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
                        if (current->edge_right_index == NULL) {
                            ~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~

/opt/ng/evogym/evogym/simulator/SimulatorCPP/Environment.cpp:294:10: error: calling a private constructor of class 'Eigen::Ref<Eigen::Matrix<double, -1, -1, 0>, 0, Eigen::OuterStride<-1>>'
                return empty;
                       ^
/opt/ng/evogym/evogym/simulator/externals/eigen/Eigen/src/Core/Ref.h:299:30: note: declared private here
    EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase<Derived>& expr,
                             ^
/opt/ng/evogym/evogym/simulator/SimulatorCPP/Environment.cpp:309:10: error: calling a private constructor of class 'Eigen::Ref<Eigen::Matrix<double, -1, -1, 0>, 0, Eigen::OuterStride<-1>>'
                return empty;
                       ^
/opt/ng/evogym/evogym/simulator/externals/eigen/Eigen/src/Core/Ref.h:299:30: note: declared private here
    EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase<Derived>& expr,
                             ^
8 warnings generated.
[ 92%] Building CXX object SimulatorCPP/CMakeFiles/simulator_cpp.dir/SimObject.cpp.o
1 warning generated.
[ 95%] Building CXX object SimulatorCPP/CMakeFiles/simulator_cpp.dir/Snapshot.cpp.o
4 errors generated.
make[2]: *** [SimulatorCPP/CMakeFiles/simulator_cpp.dir/Environment.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
25 warnings generated.
In file included from /opt/ng/evogym/evogym/simulator/SimulatorCPP/Sim.cpp:1:
In file included from /opt/ng/evogym/evogym/simulator/SimulatorCPP/Sim.h:9:
/opt/ng/evogym/evogym/simulator/SimulatorCPP/ObjectCreator.h:9:23: warning: extra tokens at end of #include directive [-Wextra-tokens]
#include "SimObject.h";
                      ^
                      //
/opt/ng/evogym/evogym/simulator/SimulatorCPP/Sim.cpp:19:28: warning: assigning field to itself [-Wself-assign-field]
        Sim::is_rendering_enabled = is_rendering_enabled;
                                  ^
2 warnings generated.
1 warning generated.
make[1]: *** [SimulatorCPP/CMakeFiles/simulator_cpp.dir/all] Error 2
make: *** [all] Error 2

using RefMatrixXd = Matrix <double, 2, Dynamic>;
#else
using RefMatrixXd = Ref <MatrixXd>;
#endif
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is switching types here. Although I was not able to determine the correct way to fix it, I was able to confirm that it is possible to build in this state.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit jank but I think this solution is better than the alternative of broken code.

using RefMatrixXd = Matrix <double, 2, Dynamic>;
#else
using RefMatrixXd = Ref <MatrixXd>;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit jank but I think this solution is better than the alternative of broken code.

requirements.txt Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update environment.yml accordingly!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for your review, and update environment.yml ecf8b19

@TakesxiSximada
Copy link
Collaborator Author

This pull request will be merged after the CI passes.

@TakesxiSximada TakesxiSximada merged commit 533b985 into EvolutionGym:main Oct 22, 2023
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

Successfully merging this pull request may close these issues.

2 participants