-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Ubuntu still requires gmp regardless of CMAKE flags #8567
Comments
Same for us: We set llvm/bin/../include/c++/v1/__type_traits/is_constructible.h:22:79: error: incomplete type 'boost::multiprecision::backends::gmp_int' used in type trait expression
22 | struct _LIBCPP_TEMPLATE_VIS is_constructible : public integral_constant<bool, __is_constructible(_Tp, _Args...)> {};
| ^
boost/libs/multiprecision/include/boost/multiprecision/detail/number_base.hpp:162:20: note: in instantiation of template class 'std::is_constructible<boost::multiprecision::backends::gmp_int, boost::multiprecision::backends::gmp_int>' requested here
162 | && (std::is_constructible<typename Num::backend_type, typename detail::canonical<T, typename Num::backend_type>::type>::value
| ^
boost/libs/multiprecision/include/boost/multiprecision/detail/default_ops.hpp:3953:1: note: in instantiation of template class 'boost::multiprecision::is_compatible_arithmetic_type<boost::multiprecision::number<boost::multiprecision::backends::gmp_int>, boost::multiprecision::number<boost::multiprecision::backends::gmp_int>>' requested here
3953 | BINARY_OP_FUNCTOR(gcd, number_kind_integer)
| ^
boost/libs/multiprecision/include/boost/multiprecision/detail/default_ops.hpp:3599:12: note: expanded from macro 'BINARY_OP_FUNCTOR'
3599 | is_compatible_arithmetic_type<Arithmetic, number<Backend, et_on> >::value && (number_category<Backend>::value == category), \
| ^
cgal/include/CGAL/CORE/BigInt.h:151:10: note: while substituting deduced template arguments into function template 'gcd' [with Backend = boost::multiprecision::backends::gmp_int, Arithmetic = BigInt]
151 | return boost::multiprecision::gcd(a,b);
| ^
boost/libs/multiprecision/include/boost/multiprecision/fwd.hpp:106:17: note: forward declaration of 'boost::multiprecision::backends::gmp_int'
106 | struct gmp_int;
| ^ |
@petrasvestartas Are you using CGAL 6.0.x or 5.6.1? |
FYI: For us this error appeared when trying to upgrade from 5.6.1 to 6.0.1. In 5.6.1 we didn't have problems with the same setup. |
If I'm doing: it compiles and if I get not gmp linked:
Could you both give it a try and let me know what you have? |
We run CMake from Bazel. We use the following configuration:
|
@mering, is it what you use to "install" CGAL? The cmake option |
I have just tried with 6.0.1 - same problem. These flags works on windows and mac, but not ubuntu: set(CGAL_CMAKE_EXACT_NT_BACKEND BOOST_BACKEND CACHE STRING "")
set(CGAL_DISABLE_GMP ON CACHE BOOL "Disable GMP in CGAL")
set(CMAKE_DISABLE_FIND_PACKAGE_GMP ON CACHE BOOL "Disable find package GMP in CMake") @sloriot If you have ubuntu, could try to run this bash file, it suppose it to work just by drag and drop in your terminal: This .cpp break the compilation with gmp: It uses: #include <CGAL/Polygon_mesh_processing/repair.h>
#include <CGAL/Polygon_mesh_processing/measure.h>
#include <CGAL/Polygon_mesh_processing/orientation.h> |
@sloriot What do you mean by "install". This basically runs |
I mean those options should be passed everytime you are compiling a program using CGAL. From what I understand the bazel config file is for copying the library in your third party path. Passing options there is actually not needed. What intricate me is that you said it is working with CGAL 5.6.1 |
@petrasvestartas running your script, it gets CGAL 5.6.1 installed. |
I have just pushed a CMake update with 6.0.1 version, could you please try again? |
It's working after having patched EDIT: Well I may have clicked too fast. I indeed have link error with gmp. Investigating... |
@sloriot |
Works with: --- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -405,7 +405,9 @@ if (BUILD_MY_PROJECTS)
# if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR APPLE)
# message("GNU OR APPLE")
# else()
- # target_link_directories(${PROJECT_NAME} PUBLIC "${CMAKE_BINARY_DIR}/install/cgal/auxiliary/gmp/lib/" )
+ set(CGAL_DIR "${CMAKE_BINARY_DIR}/install/cgal/lib/cmake/CGAL")
+ find_package(CGAL REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC CGAL::CGAL)
# endif()
###############################################################################
diff --git a/cmake/src/wood/include/cgal_box_search.h b/cmake/src/wood/include/cgal_box_search.h
index 2dee714..35ec995 100644
--- a/cmake/src/wood/include/cgal_box_search.h
+++ b/cmake/src/wood/include/cgal_box_search.h
@@ -421,7 +421,7 @@ namespace cgal
if (!result)
return false;
- if (const IK::Point_2 *p = boost::get<IK::Point_2>(&*result))
+ if (const IK::Point_2 *p = std::get_if<IK::Point_2>(&*result))
{
p0 = IK::Point_3(p->hx(), p->hy(), 0);
p0 = xform_Inv.transform(p0);
@@ -611,7 +611,7 @@ namespace cgal
if (result)
{
- if (const IK::Point_2 *p = boost::get<IK::Point_2>(&*result))
+ if (const IK::Point_2 *p = std::get_if<IK::Point_2>(&*result))
{
p0 = IK::Point_3(p->hx(), p->hy(), 0);
p0 = xform_Inv.transform(p0); |
@sloriot I think boost is detected on your system automatically. In my case boost was not found. Combined with your solution, the code below worked for me. This issue is solved (to my original question, it can be closed). ###############################################################################
# BOOST
###############################################################################
# Include directories so that boost coould find its headers
include_directories(${petras_include_paths})
# Set Boost include directory
set(BOOST_ROOT ${CMAKE_BINARY_DIR}/install/boost)
set(BOOST_INCLUDEDIR ${BOOST_ROOT}/include)
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib)
# Find Boost
find_package(Boost 1.72 REQUIRED)
###############################################################################
# CGAL
###############################################################################
# Find CGAL
set(CGAL_DIR "${CMAKE_BINARY_DIR}/install/cgal/lib/cmake/CGAL")
find_package(CGAL REQUIRED)
# Link CGAL to the project
target_link_libraries(${PROJECT_NAME} PUBLIC CGAL::CGAL) |
You can probably replace all that with: list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/install")
find_package(Boost 1.72 REQUIRED)
find_package(CGAL REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC CGAL::CGAL) The addition of See the documentation of |
@lrineau almost :) the find_package function is always a bit of magic to me. I need to add: set(BOOST_ROOT ${CMAKE_BINARY_DIR}/install/boost)` to list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/install")
find_package(Boost 1.72 REQUIRED)
find_package(CGAL REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC CGAL::CGAL) |
Seems you found the solution. Closing the issue... |
Issue Details
I set CMake flags but code still requires gmp, why?
The CMAKE code below is enough for mac and windows but not ubuntu. Please help!
Source Code
https://github.com/petrasvestartas/wood/blob/main/install_ubuntu.sh
Environment
The text was updated successfully, but these errors were encountered: