Skip to content

build(cgal): use CGAL_DISABLE_GMP, drop the GMP dependency#356

Merged
krystophny merged 1 commit into
mainfrom
build/cgal-disable-gmp
May 30, 2026
Merged

build(cgal): use CGAL_DISABLE_GMP, drop the GMP dependency#356
krystophny merged 1 commit into
mainfrom
build/cgal-disable-gmp

Conversation

@krystophny
Copy link
Copy Markdown
Member

Summary

Enabling SIMPLE_ENABLE_CGAL pulled in GMP and broke the build on machines
without GMP development headers (most HPC nodes ship libgmp.so but no
gmp.h). CGAL 6.0.1's bundled CORE defines CORE::BigInt as
boost::multiprecision::mpz_int, which requires gmp.h. The previous CMake
tried the system GMP, then fell back to building GMP 6.3.0 from source via an
ExternalProject. Both paths are fragile, and the CORE + GMP + Boost.Multiprecision
combination fails to compile regardless (CORE::BigInt does not name a type,
mpz_int in namespace boost::multiprecision does not name a type), which is
what kills the gfortran build whenever a stale cache leaves SIMPLE_ENABLE_CGAL=ON.

CGAL_DISABLE_GMP switches CORE to boost::multiprecision::cpp_int, which is
header-only and always available with Boost. The wall feature then needs only
Boost headers, no GMP at all.

  • Define CGAL_DISABLE_GMP on the stl_wall_cgal target.
  • Remove the system-GMP probe and the GMP-from-source ExternalProject.

Verification

Before, compiling the CGAL wall TU without gmp.h on the include path fails:

$ g++ -std=c++17 -DSIMPLE_ENABLE_CGAL -I<cgal>/include -c src/wall/stl_wall_cgal.cpp
CGAL/CORE_arithmetic_kernel.h:44:19: error: 'BigInt' in namespace 'CORE' does not name a type
... (771 errors, CORE needs GMP)

After (this change adds -DCGAL_DISABLE_GMP):

$ g++ -std=c++17 -DSIMPLE_ENABLE_CGAL -DCGAL_DISABLE_GMP -I<cgal>/include -c src/wall/stl_wall_cgal.cpp
exit 0   (0 errors)

g++ 12.2, CGAL 6.0.1, no GMP on the system. The wall feature builds with Boost
headers only.

The CGAL wall feature pulled in GMP: CGAL 6.0.1's bundled CORE defines
CORE::BigInt as boost::multiprecision::mpz_int, which needs gmp.h. SIMPLE tried
the system GMP and otherwise built it from source. Both are fragile: most HPC
nodes ship libgmp.so without the -dev headers, the from-source build adds a
configure/make ExternalProject to every CGAL build, and the CORE+GMP+Boost.MP
combination fails to compile (CORE::BigInt undefined / mpz_int not a type).

CGAL_DISABLE_GMP switches CORE to boost::multiprecision::cpp_int, which is
header-only and always present with Boost. The wall feature then needs only
Boost headers. Verified: stl_wall_cgal.cpp compiles cleanly with no GMP on the
include path.

Removes the system-GMP probe and the GMP-from-source ExternalProject.
@krystophny krystophny merged commit 4c5f8d1 into main May 30, 2026
7 checks passed
@krystophny krystophny deleted the build/cgal-disable-gmp branch May 30, 2026 17:44
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

Successfully merging this pull request may close these issues.

1 participant