2018-06-23 12:53 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002869OpenFOAMPatchpublic2018-03-07 21:36
Reporterhandrake0724 
Assigned Tohenry 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
Platformx86_64OSRHELOS Version6.5
Product Version5.x 
Target VersionFixed in Versiondev 
Summary0002869: CGAL_DEPRECATED_MSG error while CGAL compile with intel compiler
DescriptionmakeCGAL script makes error about CGAL_DEPRECATED_MSG with intel compiler.
It appears that this behavior is not observed in recent version of RHEL like 7.x.

my HPC environment is RHEL 6.5 with gcc 4.4.7 installed.
environment variable CC/CXX is set to icc and icpc and tried to run makeCGAL with intel compiler 2018.

then I got the following error:

Scanning dependencies of target CGAL
[ 16%] Building CXX object src/CGAL/CMakeFiles/CGAL.dir/all_files.cpp.o
In file included from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Kernel/global_functions.h(31),
                 from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Cartesian/Cartesian_base.h(30),
                 from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Simple_cartesian.h(28),
                 from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Bbox_2_Line_2_intersection_impl.h(31),
                 from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/src/CGAL/Bbox_2_intersections.cpp(28),
                 from /opt/OpenFOAM/ThirdParty-5.x/build/linux64Icc/CGAL-4.11.1/src/CGAL/all_files.cpp(1):
/opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Kernel/global_functions_2.h(362): error: invalid argument to attribute "deprecated"
  CGAL_DEPRECATED_MSG("This function is deprecated. CGAL::compare_slope() should be used instead")
  ^

In file included from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Kernel/global_functions.h(31),
                 from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Cartesian/Cartesian_base.h(30),
                 from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Simple_cartesian.h(28),
                 from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Bbox_2_Line_2_intersection_impl.h(31),
                 from /opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/src/CGAL/Bbox_2_intersections.cpp(28),
                 from /opt/OpenFOAM/ThirdParty-5.x/build/linux64Icc/CGAL-4.11.1/src/CGAL/all_files.cpp(1):
/opt/OpenFOAM/ThirdParty-5.x/CGAL-4.11.1/include/CGAL/Kernel/global_functions_2.h(372): error: invalid argument to attribute "deprecated"
  CGAL_DEPRECATED_MSG("This function is deprecated. CGAL::compare_slope() should be used instead")


the macro function is in include/CGAL/config.h

#ifdef CGAL_NO_DEPRECATION_WARNINGS
# define CGAL_DEPRECATED_MSG(msg)
#elif defined(__GNUC__) || __has_attribute(__deprecated__)
# if BOOST_GCC >= 40500 || __has_attribute(__deprecated__)
# define CGAL_DEPRECATED_MSG(msg) __attribute__ (deprecated(msg)))
# else
# define CGAL_DEPRECATED_MSG(msg) __attribute__ ((deprecated))
# endif
#elif defined (_MSC_VER) && (_MSC_VER > 1300)
# define CGAL_DEPRECATED_MSG(msg) __declspec(deprecated(msg))
#elif defined(__clang__)
# define CGAL_DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
#else
# define CGAL_DEPRECATED_MSG(msg)
#endif

the error is triggered in __has_attribute(__deprecated__) statement but I don't know why.

Anyway, the workaround for this problem is as follows:

in makeCGAL, add the following after line:282
  -DCGAL_CXX_FLAGS="-DCGAL_NO_DEPRECATED_CODE -fp-model strict" \
such that
    cmake \
        -DCMAKE_INSTALL_PREFIX=$CGAL_ARCH_PATH \
        -DCMAKE_BUILD_TYPE=Release \
        -DWITH_CGAL_Qt5=OFF \
        -DCGAL_INSTALL_LIB_DIR=lib$WM_COMPILER_LIB_ARCH \
        -DCGAL_CXX_FLAGS="-DCGAL_NO_DEPRECATED_CODE -fp-model strict" \
        $configBoost $configGmpMpfr \
        $CGAL_SOURCE_DIR \
    && make -j $WM_NCOMPPROCS \
    && make install || exit 1

Also, for files which have the dependency on CGAL including
  conformalVoronoiMesh
  foamyHexMesh
  cellSizeAndAlignmentGrid
  foamyQuadMesh

add following line to EXE_INC of each Make/options
  -DCGAL_NO_DEPRECATED_CODE \

TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0009382

henry (manager)

Why add following line to EXE_INC of each Make/options
  -DCGAL_NO_DEPRECATED_CODE \

rather than adding it to wmake/rules/General/CGAL ?

~0009383

handrake0724 (reporter)

I didn't notice that file. it is better than modifying makeCGAL directly.

~0009384

henry (manager)

What is the option "-fp-model strict" for? Is it supported by all gcc, clang and icpc versions currently supported by OpenFOAM?

~0009385

handrake0724 (reporter)

that option is added by default from cmake so ignorable.

~0009388

henry (manager)

Resolved by ThirdParty-dev commit bcb438a255f308712db82547f5f8f2fba71005ad

and OpenFOAM-dev commit adb1a081683f498a87c7ae0adf4b468ead95c7dc
+Notes

-Issue History
Date Modified Username Field Change
2018-03-07 12:50 handrake0724 New Issue
2018-03-07 13:12 henry Note Added: 0009382
2018-03-07 13:36 handrake0724 Note Added: 0009383
2018-03-07 14:48 henry Note Added: 0009384
2018-03-07 14:51 handrake0724 Note Added: 0009385
2018-03-07 21:36 henry Assigned To => henry
2018-03-07 21:36 henry Status new => resolved
2018-03-07 21:36 henry Resolution open => fixed
2018-03-07 21:36 henry Fixed in Version => dev
2018-03-07 21:36 henry Note Added: 0009388
+Issue History