uoip / g2opy

Python binding of SLAM graph optimization framework g2o
668 stars 176 forks source link

Install on ubuntu 20.04 #48

Closed kevkid closed 3 years ago

kevkid commented 3 years ago

Before starting ensure you are building it with your version of python in mind:

Solution is in /path/to/g2opy/build, run: cmake -DPYBIND11_PYTHON_VERSION=3.8 ..

Originally posted by @travelbureau in https://github.com/uoip/g2opy/issues/9#issuecomment-396778016

I have just installed this on ubuntu 20.04, if you are having difficulty building and get:

........
make[2]: *** [python/CMakeFiles/g2o.dir/build.make:63:python/CMakeFiles/g2o.dir/g2o.cpp.o] error 1
make[1]: *** [CMakeFiles/Makefile2:1345:python/CMakeFiles/g2o.dir/all] error 2
make: *** [Makefile:130:all] error 2

follow this issue: https://github.com/uoip/g2opy/issues/46 by doing: I encountered the same problem on Ubuntu 20.04. In my case, I could build the library by changing:

        .def("x", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::x)
        .def("y", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::y)
        .def("z", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::z)
        .def("w", (double (Eigen::Quaterniond::*) () const) &Eigen::Quaterniond::w)

in g2opy/python/core/eigen_types.h to:

        .def("x", [](const Eigen::Quaterniond& q) { return q.x(); })
        .def("y", [](const Eigen::Quaterniond& q) { return q.y(); })
        .def("z", [](const Eigen::Quaterniond& q) { return q.z(); })
        .def("w", [](const Eigen::Quaterniond& q) { return q.w(); })

Originally posted by @koide3 in https://github.com/uoip/g2opy/issues/46#issuecomment-704190419