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

fatal error: 'boost/geometry/strategies/agnostic/hull_graham_andrew.hpp' file not found #8982

Open
3 tasks done
razr opened this issue Sep 29, 2024 · 6 comments
Open
3 tasks done

Comments

@razr
Copy link

razr commented Sep 29, 2024

Checklist

  • I've read the contribution guidelines.
  • I've searched other issues and no duplicate issues were found.
  • I'm convinced that this is not my fault but a bug.

Description

I have boost 1.81 and autoware_universe_utils fails to compile with it.

/home/user/build/autoware/autoware_ws/src/universe/autoware.universe/common/autoware_universe_utils/src/geometry/random_concave_polygon.cpp:22:10: fatal error: 'boost/geometry/strategies/agnostic/hull_graham_andrew.hpp' file not found
   22 | #include <boost/geometry/strategies/agnostic/hull_graham_andrew.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

boost/geometry/strategies/agnostic/hull_graham_andrew.hpp has been removed from boost starting from 1.76.0, please see https://github.com/boostorg/geometry/tree/boost-1.76.0/include/boost/geometry/strategies/agnostic

Maybe find package should be written as:

find_package(Boost REQUIRED)
if(Boost_VERSION VERSION_GREATER 107500)
  message(FATAL_ERROR "Boost version must be 1.75 or less")
endif()

Expected behavior

see description

Actual behavior

see description

Steps to reproduce

see description

Versions

No response

Possible causes

see description

Additional context

No response

@maxime-clem
Copy link
Contributor

@razr fixing the maximum version with CMake will not fix the build issue. Is this okay ?
I think we can check the boost version in the cpp files to determine whether to include the header or not.

#include <boost/version.hpp>
#if BOOST_VERSION < 107600
  #include <boost/geometry/strategies/agnostic/hull_graham_andrew.hpp>
#endif

The call to boost::geometry::convex_hull must probably also be conditioned on the BOOST_VERSION.

@zehranrgi
Copy link

zehranrgi commented Nov 9, 2024

When I run this code before colcon build

rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
it downgraded the boost version to 1.74. So, I am not sure how you have boost 1.81? correct me, please.

@zehranrgi
Copy link

zehranrgi commented Nov 9, 2024

I realized that there are two boost version in my case.
So, I updated the autoware_universe_utils> CMakeList.txt as :

`

cmake_minimum_required(VERSION 3.14)
project(autoware_universe_utils)


include_directories(BEFORE SYSTEM /usr/include)
set(CMAKE_IGNORE_PATH "/usr/local/include")


option(BUILD_EXAMPLES "Build examples" OFF)

find_package(autoware_cmake REQUIRED)
autoware_package()

##find_package(Boost REQUIRED)
find_package(Boost REQUIRED COMPONENTS date_time)

find_package(fmt REQUIRED)

ament_auto_add_library(autoware_universe_utils SHARED
  src/geometry/alt_geometry.cpp
  src/geometry/geometry.cpp
  src/geometry/pose_deviation.cpp
  src/geometry/boost_polygon_utils.cpp
  src/geometry/random_convex_polygon.cpp
  src/geometry/random_concave_polygon.cpp
  src/geometry/gjk_2d.cpp
  src/geometry/sat_2d.cpp
  src/math/sin_table.cpp
  src/math/trigonometry.cpp
  src/ros/msg_operation.cpp
  src/ros/marker_helper.cpp
  src/ros/logger_level_configure.cpp
  src/system/backtrace.cpp
  src/system/time_keeper.cpp
  src/geometry/ear_clipping.cpp
)

target_link_libraries(autoware_universe_utils
  fmt::fmt
)

if(BUILD_TESTING)
  find_package(ament_cmake_ros REQUIRED)

  file(GLOB_RECURSE test_files test/**/*.cpp)

  ament_add_ros_isolated_gtest(test_autoware_universe_utils ${test_files})

  target_link_libraries(test_autoware_universe_utils
    autoware_universe_utils
  )
endif()

if(BUILD_EXAMPLES)
  message(STATUS "Building examples")
  file(GLOB_RECURSE example_files examples/*.cpp)

  foreach(example_file ${example_files})
    get_filename_component(example_name ${example_file} NAME_WE)
    add_executable(${example_name} ${example_file})
    target_link_libraries(${example_name}
      autoware_universe_utils
    )
    install(TARGETS ${example_name}
      DESTINATION lib/${PROJECT_NAME}
    )
  endforeach()
endif()

ament_auto_package()

`

then, also,

sudo mv /usr/local/include/boost /usr/local/include/boost_backup

@razr
Copy link
Author

razr commented Nov 9, 2024

@zehranrgi Thank you for looking into it. My OS includes Boost 1.81, which generally works well, except in this specific case. I’ve downgraded to Boost 1.76 and the issue is resolved. So, nothing critical, I just want to point out that there is a dependency in the source code on particular BOOST release.

@zehranrgi
Copy link

Yes, it needs boost 1.76.

But, also I am getting these errors:

CMake Error at /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:50 (add_executable):
  Target "test_autoware_universe_utils" links to target "Boost::date_time"
  but the target was not found.  Perhaps a find_package() call is missing for
  an IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest_executable.cmake:37 (_ament_add_gtest_executable)
  /opt/ros/humble/share/ament_cmake_gtest/cmake/ament_add_gtest.cmake:68 (ament_add_gtest_executable)
  /opt/ros/humble/share/ament_cmake_ros/cmake/ament_add_ros_isolated_gtest.cmake:33 (ament_add_gtest)
  CMakeLists.txt:43 (ament_add_ros_isolated_gtest)

@jiemdev
Copy link

jiemdev commented Nov 13, 2024

Hi,
Looks like the class has been moved to boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp from boost v1.76?

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

4 participants