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

g2o: new recipe #22337

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

g2o: new recipe #22337

wants to merge 17 commits into from

Conversation

valgur
Copy link
Contributor

@valgur valgur commented Jan 14, 2024

Adds g2o: https://github.com/RainerKuemmerle/g2o

g2o: A General Framework for Graph Optimization

It's currently missing important, but optional, SuiteSparse and CSparse solver dependencies, which are not yet available on CCI.

Packaging status

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@AbrilRBS AbrilRBS self-assigned this Jan 16, 2024
Comment on lines 121 to 123
# Used in stuff/opengl_wrapper.h
self.requires("opengl/system", transitive_headers=True, transitive_libs=True)
self.requires("glu/system", transitive_headers=True, transitive_libs=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use the mesa-glu and libglvnd packages where possible here?

Suggested change
# Used in stuff/opengl_wrapper.h
self.requires("opengl/system", transitive_headers=True, transitive_libs=True)
self.requires("glu/system", transitive_headers=True, transitive_libs=True)
# Used in stuff/opengl_wrapper.h
if self.settings.os in ["FreeBSD", "Linux"]:
self.requires("libglvnd/1.7.0", transitive_headers=True, transitive_libs=True)
else:
self.requires("opengl/system", transitive_headers=True, transitive_libs=True)
if is_apple_os(self) or self.settings.os == "Windows":
self.requires("glu/system", transitive_headers=True, transitive_libs=True)
else:
self.requires("mesa-glu", transitive_headers=True, transitive_libs=True)

FYI, CMake prior to 3.29 doesn't do a very good job of handling the GLU headers via the FindOpenGL module, so that may require workarounds like I had to do in the FreeGLUT recipe.

self.cpp_info.components["g2o_ceres_ad"].set_property("cmake_target_name", "g2o::g2o_ceres_ad")
_add_component("stuff", requires=["spdlog::spdlog", "eigen::eigen"])
_add_component("core", requires=["stuff", "eigen::eigen", "g2o_ceres_ad"])
_add_component("opengl_helper", requires=["opengl::opengl", "glu::glu", "eigen::eigen"])
Copy link
Contributor

@jwillikers jwillikers Mar 25, 2024

Choose a reason for hiding this comment

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

Suggested change
_add_component("opengl_helper", requires=["opengl::opengl", "glu::glu", "eigen::eigen"])
opengl_helper_requires = ["eigen::eigen"]
if self.settings.os in ["FreeBSD", "Linux"]:
opengl_helper_requires.append("libglvnd::gl")
else:
opengl_helper_requires.append("opengl::opengl")
if is_apple_os(self) or self.settings.os == "Windows":
opengl_helper_requires.append("glu::glu")
else:
opengl_helper_requires.append("mesa-glu::mesa-glu")
_add_component("opengl_helper", requires=opengl_helper_requires)

I'm not sure which component of libglvnd you need here. libglvnd::gl is the legacy GL implementation for X11, pretty much GLX.


from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
from conan.tools.build import check_min_cppstd
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ❌

Failure in build 5 (47b54914ed48d07a935c9636b9cf209581ffac57):

  • g2o/20230806:
    CI failed to create some packages (All logs)

    Logs for packageID c6a2a96a938ba5b0cfca85082c9ffee445f8d56d:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.libcxx=libstdc++11
    compiler.version=9
    os=Linux
    [options]
    g2o:shared=False
    
    [...]
    dpkg-query: no packages found matching libxv-dev
    dpkg-query: no packages found matching libxcb-render-util0-dev
    dpkg-query: no packages found matching libxcb-xkb-dev
    dpkg-query: no packages found matching libxcb-icccm4-dev
    dpkg-query: no packages found matching libxcb-image0-dev
    dpkg-query: no packages found matching libxcb-keysyms1-dev
    dpkg-query: no packages found matching libxcb-xinerama0-dev
    dpkg-query: no packages found matching uuid-dev
    dpkg-query: no packages found matching libxcb-cursor-dev
    dpkg-query: no packages found matching libxcb-composite0-dev
    dpkg-query: no packages found matching libxcb-ewmh-dev
    dpkg-query: no packages found matching libxcb-res0-dev
    debconf: delaying package configuration, since apt-utils is not installed
    dpkg-query: no packages found matching libxcb-util-dev
    debconf: delaying package configuration, since apt-utils is not installed
    CMake Warning at CMakeLists.txt:128 (find_package):
      By not providing "FindCSPARSE.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "CSPARSE", but
      CMake did not find one.
    
      Could not find a package configuration file provided by "CSPARSE" with any
      of the following names:
    
        CSPARSEConfig.cmake
        csparse-config.cmake
    
      Add the installation prefix of "CSPARSE" to CMAKE_PREFIX_PATH or set
      "CSPARSE_DIR" to a directory containing one of the above files.  If
      "CSPARSE" provides a separate development package or SDK, be sure it has
      been installed.
    
    
    Qt5 not found. Install it and set Qt5_DIR accordingly
    /home/conan/workspace/prod-v1/bsr/66957/adddd/.conan/data/g2o/20230806/_/_/build/c6a2a96a938ba5b0cfca85082c9ffee445f8d56d/src/g2o/stuff/opengl_primitives.cpp:27:10: fatal error: GL/glu.h: No such file or directory
       27 | #include <GL/glu.h>
          |          ^~~~~~~~~~
    compilation terminated.
    make[2]: *** [g2o/stuff/CMakeFiles/opengl_helper.dir/build.make:82: g2o/stuff/CMakeFiles/opengl_helper.dir/opengl_primitives.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:553: g2o/stuff/CMakeFiles/opengl_helper.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    make: *** [Makefile:171: all] Error 2
    WARN: *** Conan 1 is legacy and on a deprecation path ***
    WARN: *** Please upgrade to Conan 2 ***
    g2o/20230806: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    g2o/20230806: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    g2o/20230806: ERROR: Package 'c6a2a96a938ba5b0cfca85082c9ffee445f8d56d' build failed
    g2o/20230806: WARN: Build folder /home/conan/workspace/prod-v1/bsr/66957/adddd/.conan/data/g2o/20230806/_/_/build/c6a2a96a938ba5b0cfca85082c9ffee445f8d56d/build/Release
    ERROR: g2o/20230806: Error in build() method, line 208
    	cmake.build()
    	ConanException: Error 2 while executing cmake --build "/home/conan/workspace/prod-v1/bsr/66957/adddd/.conan/data/g2o/20230806/_/_/build/c6a2a96a938ba5b0cfca85082c9ffee445f8d56d/build/Release" '--' '-j3'
    

Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.


Conan v2 pipeline ❌

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping @conan-io/barbarians on the PR and we will help you.

Failure in build 5 (47b54914ed48d07a935c9636b9cf209581ffac57):

  • g2o/20230806:
    CI failed to create some packages (All logs)

    Logs for packageID d5958526b4e99cd5b0f0c52a571bf646c359247a:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.cppstd=17
    compiler.libcxx=libstdc++11
    compiler.version=11
    os=Linux
    [options]
    */*:shared=False
    
    [...]
    -- Conan: Component target declared 'wayland::wayland-client'
    -- Conan: Component target declared 'wayland::wayland-cursor'
    -- Conan: Component target declared 'wayland::wayland-egl'
    -- Conan: Component target declared 'wayland::wayland-egl-backend'
    -- Conan: Target declared 'wayland::wayland'
    -- Conan: Target declared 'libffi::libffi'
    -- Conan: Target declared 'LibXml2::LibXml2'
    -- Conan: Target declared 'ZLIB::ZLIB'
    -- Conan: Target declared 'Iconv::Iconv'
    -- Conan: Including build module from '/home/conan/workspace/prod-v2/bsr/59956/afebc/p/libxm13ba99bc5c25b/p/lib/cmake/conan-official-libxml2-variables.cmake'
    -- Conan: Target declared 'expat::expat'
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/conan/workspace/prod-v2/bsr/59956/afebc/p/b/g2o7c83bebaeb6c6/b/build/Release
    
    g2o/20230806: Running CMake.build()
    g2o/20230806: RUN: cmake --build "/home/conan/workspace/prod-v2/bsr/59956/afebc/p/b/g2o7c83bebaeb6c6/b/build/Release" -- -j3
    Scanning dependencies of target opengl_helper
    [  1%] Building CXX object g2o/stuff/CMakeFiles/opengl_helper.dir/opengl_primitives.cpp.o
    Scanning dependencies of target stuff
    [  2%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/timeutil.cpp.o
    [  2%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/command_args.cpp.o
    /home/conan/workspace/prod-v2/bsr/59956/afebc/p/b/g2o7c83bebaeb6c6/b/src/g2o/stuff/opengl_primitives.cpp:27:10: fatal error: GL/glu.h: No such file or directory
       27 | #include <GL/glu.h>
          |          ^~~~~~~~~~
    compilation terminated.
    g2o/stuff/CMakeFiles/opengl_helper.dir/build.make:62: recipe for target 'g2o/stuff/CMakeFiles/opengl_helper.dir/opengl_primitives.cpp.o' failed
    make[2]: *** [g2o/stuff/CMakeFiles/opengl_helper.dir/opengl_primitives.cpp.o] Error 1
    CMakeFiles/Makefile2:164: recipe for target 'g2o/stuff/CMakeFiles/opengl_helper.dir/all' failed
    make[1]: *** [g2o/stuff/CMakeFiles/opengl_helper.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    [  3%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/sparse_helper.cpp.o
    [  4%] Building C object g2o/stuff/CMakeFiles/stuff.dir/os_specific.c.o
    [  4%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/filesys_tools.cpp.o
    [  5%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/string_tools.cpp.o
    [  6%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/property.cpp.o
    [  6%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/sampler.cpp.o
    [  7%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/tictoc.cpp.o
    [  8%] Building CXX object g2o/stuff/CMakeFiles/stuff.dir/logger.cpp.o
    [  9%] Linking CXX static library ../../lib/libg2o_stuff.a
    [  9%] Built target stuff
    Makefile:151: recipe for target 'all' failed
    make: *** [all] Error 2
    
    g2o/20230806: ERROR: 
    Package 'd5958526b4e99cd5b0f0c52a571bf646c359247a' build failed
    g2o/20230806: WARN: Build folder /home/conan/workspace/prod-v2/bsr/59956/afebc/p/b/g2o7c83bebaeb6c6/b/build/Release
    ERROR: g2o/20230806: Error in build() method, line 208
    	cmake.build()
    	ConanException: Error 2 while executing
    

Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

@metalMajor
Copy link
Contributor

Hello, I have added a PR to your fork to be able to disable the opengl option:

valgur#10

@rettichschnidi
Copy link

rettichschnidi commented Nov 29, 2024

I'd be interested in this recipe being on the index. Anything I can do as outsider to help this getting pushed forward?

@valgur
Copy link
Contributor Author

valgur commented Nov 30, 2024

@rettichschnidi The g2o recipe is blocked by SuiteSparse support on CCI (#23546), which in turn is blocked by the limited OpenMP support on CCI (#22360, #24577), as it relies solely on OpenMP for parallelization support. It currently cannot be built on CCI and potentially many Linux-based consumer machines due to missing OpenMP runtimes.
You can join the discussion on the OpenMP issues, if you feel like it, to help show that the need for improvements is not just a weird obsession of mine and that users on macOS do actually wish to use linear algebra libraries relying on OpenMP, despite Apple's attempts to force its native frameworks (Accelerate and GCD) on its users.

@valgur
Copy link
Contributor Author

valgur commented Nov 30, 2024

Also, in the mean time, you can use my CCI fork that has support for g2o and many other CV/robotics libraries: https://github.com/valgur/conan-center-index

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

Successfully merging this pull request may close these issues.

[request] g2o/20201223
6 participants