GUDHI / gudhi-devel

The GUDHI library is a generic open source C++ library, with a Python interface, for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.
https://gudhi.inria.fr/
MIT License
245 stars 65 forks source link

Compilation error for version 3.10.0, only with CGAL 6 #1092

Closed gspr closed 5 days ago

gspr commented 1 week ago

When building GUDHI 3.10.0 with CGAL 6, I see the following error:

[ 16%] Building CXX object example/Contraction/CMakeFiles/RipsContraction.dir/Rips_contraction.cpp.o
cd /BASE/gudhi-3.10.0+dfsg/build/userversion/build/example/Contraction && /usr/bin/c++ -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB -DBOOST_RESULT_OF_USE_DECLTYPE -DBOOST_SYSTEM_NO_DEPRECATED -DCGAL_USE_GMPXX=1 -DGUDHI_USE_TBB -I/BASE/gudhi-3.10.0+dfsg/build/userversion/include -g -O2 -ffile-prefix-map=/BASE/gudhi-3.10.0+dfsg=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -std=gnu++17 -frounding-math -MD -MT example/Contraction/CMakeFiles/RipsContraction.dir/Rips_contraction.cpp.o -MF CMakeFiles/RipsContraction.dir/Rips_contraction.cpp.o.d -o CMakeFiles/RipsContraction.dir/Rips_contraction.cpp.o -c /BASE/gudhi-3.10.0+dfsg/build/userversion/example/Contraction/Rips_contraction.cpp
In file included from /BASE/gudhi-3.10.0+dfsg/build/userversion/include/gudhi/Edge_contraction.h:15,
                 from /BASE/gudhi-3.10.0+dfsg/build/userversion/example/Contraction/Rips_contraction.cpp:10:
/BASE/gudhi-3.10.0+dfsg/build/userversion/include/gudhi/Skeleton_blocker_contractor.h: In instantiation of 'boost::optional<typename GeometricSimplifiableComplex::Edge_handle> Gudhi::contraction::Skeleton_blocker_contractor<GeometricSimplifiableComplex, EdgeProfile>::pop_from_PQ() [with GeometricSimplifiableComplex = Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex<Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait> >; EdgeProfile = Gudhi::contraction::Edge_profile<Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex<Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait> > >; typename GeometricSimplifiableComplex::Edge_handle = boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int>]':
/BASE/gudhi-3.10.0+dfsg/build/userversion/include/gudhi/Skeleton_blocker_contractor.h:340:20:   required from 'void Gudhi::contraction::Skeleton_blocker_contractor<GeometricSimplifiableComplex, EdgeProfile>::contract_edges(int) [with GeometricSimplifiableComplex = Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex<Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait> >; EdgeProfile = Gudhi::contraction::Edge_profile<Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex<Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait> > >]'
/BASE/gudhi-3.10.0+dfsg/build/userversion/example/Contraction/Rips_contraction.cpp:70:28:   required from here
/BASE/gudhi-3.10.0+dfsg/build/userversion/include/gudhi/Skeleton_blocker_contractor.h:266:62: error: conversion from 'std::optional<boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int> >' to non-scalar type 'boost::optional<boost::detail::edge_desc_impl<boost::undirected_tag, long unsigned int> >' requested
  266 |     boost::optional<Edge_handle> edge = heap_PQ_->extract_top();
      |                                         ~~~~~~~~~~~~~~~~~~~~~^~

Building the exact same code with CGAL 5.5 works fine.

I realize that this bug report is very vague, but it's all I've had time for so far. Boost is at version 1.83.0.2. The CGAL version is 6.0 beta 1.

PS: I've just been blindly assuming 3.10.0 supports CGAL 6 due to some comments in the release notes. Apologies in advance if that is not the case!

gspr commented 1 week ago

Steps to reproduce:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DUSER_VERSION_DIR=userversion -DWITH_GUDHI_EXAMPLE=true ..
make user_version
cd userversion
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GUDHI_EXAMPLE=true ..
make VERBOSE=1

This won't reproduce exactly the log snippet above (that was produced using different flags), but it will reproduce the same error with CGAL 6.

mglisse commented 1 week ago

Ah, right, we had seen it and it slipped our minds, sorry. The slightly painful part is being compatible with both cgal-5 and cgal-6...

gspr commented 1 week ago

On 27 June 2024 16:38:15 CEST, Marc Glisse @.***> wrote:

Ah, right, we had seen it and it slipped our minds, sorry. The slightly painful part is being compatible with both cgal-5 and cgal-6...

Understable! Do you have some notes I could test out? Debian is preparing to move to CGAL 6 for unstable and the next stable release, and I'm happy to maintain a Debian-only patch until GUDHI moves to CGAL 6 properly.

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

mglisse commented 1 week ago

Completely untested, I was thinking of replacing

    boost::optional<Edge_handle> edge = heap_PQ_->extract_top();
    if (edge)
      get_data(*edge).reset_PQ_handle();

with

    boost::optional<Edge_handle> edge;
    if (!heap_PQ_->empty()) {
      edge = heap_PQ_->top();
      heap_PQ_->pop();
      get_data(*edge).reset_PQ_handle();
    }

which should remain compatible with CGAL-5.