Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] frounding math trouble with GCC 4.0.1

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] frounding math trouble with GCC 4.0.1


Chronological Thread 
  • From: Sylvain Pion <>
  • To:
  • Subject: Re: [cgal-discuss] frounding math trouble with GCC 4.0.1
  • Date: Wed, 27 May 2009 14:50:54 +0200
  • Organization: INRIA

Shamyl Zakariya wrote:
I just installed CGAL 3.4 ( was using 3.1 ) and on running my app,
CGAL terminates with the following error during static initialization:

terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: -CGAL_IA_MUL(-1.1, 10.1) != CGAL_IA_MUL(1.1, 10.1)
File: /usr/local/include/CGAL/Interval_nt.h
Line: 154
Explanation: Wrong rounding: did you forget the -frounding-math option
if you use GCC?

This is on Mac OS X, 10.5.7

So, assuming I made some sort of mistake during the configuration of
CGAL, I redownloaded the tarball and reconfigured it as such:

# cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=FALSE

And I'm seeing the following during configuration, which implies to me
that the build system is automatically adding -frounding-math...

-- Targetting Unix Makefiles
-- Using /opt/local/bin/c++ compiler.
-- DARWIN_VERSION=9
-- Mac Leopard detected
-- USING CMake version: 2.6.4
-- System: Darwin
-- USING GCC_VERSION = '4.0.1 (Apple Inc. build 5490)'
-- Using gcc version 4 or later. Adding -frounding-math
-- Build type: Release
-- USING CXXFLAGS = ' -frounding-math -O3 -DNDEBUG'

However, ever after this rebuild/reinstall my apps still die on the assertion.

(Please note, I'm not using any of the optional numeric packages, and
I'm using boost 1.36, and cmake 2.6)

I'm not sure what you mean exactly by "optional numeric packages",
but this check is useful as soon as you use CGAL::Interval_nt, which
is used in the filtered kernels (e.g. when you use Delaunay).

This check can be disabled with -DCGAL_DISABLE_ROUNDING_MATH_CHECK
(though of course you should never have to do that).

However, note that -DNDEBUG (which you have), also should disable this check.
Which means that the flags you see are not passed to the compilation
process correctly. Note that -frounding-math is also needed when
compiling/installing CGAL itself.

I'm not proficient enough in CMake to tell what can go wrong there,
maybe someone else can help.


Side note : Apple's g++ 4.0.1 is strongly discouraged for CGAL as soon
as you want to compile with optimization (you can e.g. upgrade Xcode
to get g++ 4.2).

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/



Archive powered by MHonArc 2.6.16.

Top of Page